PHP Help

K

knaggsy

Guest
Hi everyone I am trying to learn php but I am really stuck at the moment with the basics does anyone know of any really good tutorials for php or any websites that have example scripts for me to use or at least base my php pages on?

Any help you could give me would be really appreciated.

Cheers

Tim
 
Joined
Jul 25, 2004
Messages
389
Reaction score
5
Points
18
Location
Gaithersburg, MD
Your Mac's Specs
Mac Pro 2.6ghz Quad Xeon, 23" Cinema
Best bet is buy a book from amazon.
 
OP
I

iSheep

Guest
I recommend:
PHP for the World Wide Web (Visual QuickStart Guides) ~Larry Ullman (Peachpit Press)

Wonderful book - tought me a lot! It also has a Visual Pro Guide to follow it, and a MySQL with PHP book if you want that as well. Highly recommended.
 
OP
K

knaggsy

Guest
Thanks guys for all of your help I really appreciate it I will be wading my way through those links and hopefully will make sense of it eventually lol Thanks again

cheers

Tim
 
OP
D

design2

Guest
php help.

i have setup a weblog page where normal users can only view the logs
however if you are successfully logged in i want an EDIT link to appear next to each log and when you click that link it uses that ID to go to my weblog edit page. i thought i had it all covered, but i think i've missed something small.

here's the JUICY code..

<?php
if(isset($_SESSION['MM_Username']) && isset($_SESSION['MM_UserAuthorization'])) {
echo '<a href="weblog_edit.php?id=' . $row_rs_weblog['id'] . '">EDIT</a> ';
}
?>
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
What are you missing? that's only a tiny part of the code and that looks fine from what I can see.. it's not going to throw any errors at least..
 
OP
D

design2

Guest
this is pretty much the weblog page.
but the only part of my php that isnt working is the "edit" which is not appearing next to the logs? my navbar includes work, my database logs work, etc


<?php require_once('Connections/liam_php.php'); ?>
<?php
mysql_select_db($database_liam_php, $liam_php);
$query_rs_weblog = "SELECT * FROM weblog ORDER BY `date` DESC";
$rs_weblog = mysql_query($query_rs_weblog, $liam_php) or die(mysql_error());
$row_rs_weblog = mysql_fetch_assoc($rs_weblog);
$totalRows_rs_weblog = mysql_num_rows($rs_weblog);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Ambury Park Centre for Riding Therapy > News</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="CSS/ambury.css" rel="stylesheet" type="text/css">
</head>

<body>
 
OP
D

design2

Guest
<?php do { ?>
<p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"> <br>
<?php echo $row_rs_weblog['date']; ?> - <?php echo $row_rs_weblog['name']; ?><br>
<?php echo $row_rs_weblog['content']; ?>
<?php
if(isset($_SESSION['MM_Username']) && isset($_SESSION['MM_UserAuthorization'])) {
echo '<a href="weblog_edit.php?id=' . $row_rs_weblog['id'] . '">EDIT</a> ';
}
?>
</font>
<?php } while ($row_rs_weblog = mysql_fetch_assoc($rs_weblog)); ?>
<p></p>
<p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><a href="menu.php"><font size="-2">go
to admin menu</font></a></font></p>
<p></p>
</div>
</td>
<td width="24%" align="right" valign="top">
<?php include("inc/navbar.php"); ?></td>
</tr>

</table>

</body>
</html>
<?php
mysql_free_result($rs_weblog);
?>
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
Try putting this above this line like so:

print_r($_SESSION); die;
if(isset($_SESSION['MM_Username']) && isset($_SESSION['MM_UserAuthorization'])) {

And make sure that those two session variables are even being set.
 
OP
D

design2

Guest
actually that didn't work.

instead everything dissapears..
how do i make sure that those two session variables are even being set?
i actually don't know much, i let dreamweaver do it all, and get help
from a php friend.

any more suggestions?
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
If that didn't work, then that means you do not even have a session going. You'll need to start that session.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top