954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

syntax error PHP with mySql

this my new syntax for my new website

echo "<li class='childmenu'><a href=#equipment?id='".$row['id']."'>".$row['name']."</a></li>";


and this is the old one for my another website

$isi .= "<li><b><a class='topikMenu' href=reset/survey.php?id=".$row['kodetopik']."><span title='".$row['jumlahpenyurvey']." surveyor'>".$row['namatopik']."</span></a></b>";


I think it's same concept about give the $row[''] in the middle of html syntax, but I don't know why my new syntax is error at , the $row[''] cannot read by php.. but that can display at web, but the link just #equipment?id=''.. it's blank T_T

Please for your advice..
Thanks

xuweisen
Newbie Poster
14 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

could it be the version of mysql that I use? because that two syntax I made with different version of mysql.. :(

This is the whole syntax

<?php
						echo "<ul>";
							$query="SELECT name FROM equipment_category ORDER BY id";
							$result=mysql_query($query,$connection);

							if(mysql_num_rows($result)>0){
								while($row=mysql_fetch_assoc($result)){
									echo "<li class='childmenu'><a href=#equipment?id='".$row['id']."'>".$row['name']."</a></li>";
								}
								mysql_free_result($result);
							}
						echo "</ul>";
					?>
xuweisen
Newbie Poster
14 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

id is missing from your query, so it has no value. Use:

SELECT id, name FROM equipment_category ORDER BY id
pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

waaaaaa.. thanks very much.. oh God.. I think this is the foolest question, I'm not clearly read my syntax.. really really sorry and thanks.. :)

xuweisen
Newbie Poster
14 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

Please mark this thread solved.

pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

ok.. thanks pritaeas.. :)

xuweisen
Newbie Poster
14 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You