Jump to content

echo help, include java string


herghost
 Share

Recommended Posts

Thanks,

 

I also would like to know how to display more than one row from my database, this is the query I have, but it only shows the 1st row, how would I make it show all rows?

 

 

<?php		$query = mysql_query("SELECT * FROM cats WHERE level='1' LIMIT 2");		if (!$query) {    echo "Could not run query: " . mysql_error();    exit;}		$row = mysql_fetch_row($query);		{			echo "<li><a href=\"javascript:ajaxpage('" . $row[1] . ".php', 'content');\">" . $row[1] . "</a></li>";		}		?>

 

Link to comment
Share on other sites

Sorry to be blunt, but every php/mysql book or basic php/mysql tutorial shows how to retrieve multiple rows from a query. You are asking something that is very basic, so it would seem that you have not bothered to learn the basic information that you need to know before you are attempting to do this with your data. (Before you can write a book, you must know how to write at all.)

 

If you take the time to learn some of the basic php/mysql programming information, you can produce working code at least 10 times faster than if you just try things you might have seen without knowing what they mean or what each line of code actually does.

 

A basic php/mysql tutorial that executes a query and iterates over all the rows that it returns -

http://w3schools.com/php/php_mysql_select.asp

Link to comment
Share on other sites

Thans to both, I will do some further reading, I just like the learn as you go approach, once I can see something working I can then replicate it and learn as I go, I did have a read about, but I was looking at foreach and I could not find an example which took results from a database

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.