Now you talk about weird!! I'm totally stumpted

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rathlon
Forum Commoner
Posts: 45
Joined: Sun Nov 10, 2002 8:07 pm

Now you talk about weird!! I'm totally stumpted

Post by rathlon »

for($i = 0; $i < $num_rows; $i++)
{
$row = mysql_fetch_row($result);
if($i % 2)
{
echo "<table border=\"1\" width=\"700px\">";
}
else
{
echo "<table border=\"1\" width=\"700px\">";
}
echo "<tr>";
echo "<td>";
for($k = 0; $k < 1; $k++)
{
$title = stripslashes($row[$k]);
echo " * <b><a href=\"update_module.php?title=$title&id=$i\">$title</a></b></u> * ";
echo "<br>";
echo "<b>Project Number: </b>&nbsp;&nbsp;".$row[1];
echo "<br>";
echo "<b>Primary POC: </b>&nbsp;&nbsp;&nbsp;&nbsp";
echo "<b>".$row[2]."<br>";
echo "<b>Alternate POC: </b>&nbsp;&nbsp;";
echo "<b>".$row[3]."<br>";
echo "<br>";
echo "Project Description:&nbsp;&nbsp;";
echo $desc[$i][0];
}
echo "</td>";
echo "</tr>";
echo "</table>";
}

This works great while the value of $i is 1 - 3. When it hits 4, it still displays everything ok, but when you click the link and try to pass the $id var, it says on the next page (where you make a reference to $id) that $id is an undefined variable, like it has no value. What's really weird is if you'll notice the $desc[][] echo. It comes AFTER the $id var is defined for passing through the link. And guess what...the desc[][] echo's index 4 great. Someone please tell me what I'm missing.
rathlon
Forum Commoner
Posts: 45
Joined: Sun Nov 10, 2002 8:07 pm

Post by rathlon »

Allow me to answer myself. Seems mysql had a problem with the name "test #2". Even though I'm using the addslashes() function in the insert script...something isn't clicking right. Can someone explain further?
User avatar
9902468
Forum Commoner
Posts: 89
Joined: Thu Jun 06, 2002 6:39 am
Location: Europe

Post by 9902468 »

Ok. Sounds like you should
1. read some php tut
2. understand it
3. write code

But anyway put your code between code tags so we can read it better, also when you refer to the variable in the next page it is named $_GET['variable_name']... (PHP parses all variables in that array that are passed via url.) Explain more what is not working and someone might help...
Post Reply