Jump to content

can I get some help about php and mysql interation?


shedokan

Recommended Posts

I tried and tried to make this but with no luck:

 

I tried to make php get information from the database and then output it in a form like this:

 

in the database:

number|name

-------|-----

1 | jon

2 |josh

then more names and numbers.

 

php:

 

<li>1</li>

<li>2</li>

and then more numbers in this form.

 

can you help me ith this or tell me where I can get help about this?

 

if you can help me I will say you thanks a million times!

 

I'm creting a list of games in the database and the table name is games, the variables are name and url.

 

and I need to make the links to update automaticly so when I will put the information into the database so then it shows in the links page like this:

 

<a href"game1">game1</a>

<a href"game2">game2</a>

<a href"game3">game3</a>

<a href"game4">game4</a>

<a href"game5">game5</a>

and when I add more links to the database so it adds more links here

<?php

$query = mysql_query("SELECT number, name, url FROM games") or die(mysql_error());

while ( $row = mysql_fetch_array( $query ) ) {

$number = $row['number'];
$name = $row['name'];
$url = $row['url'];

$table_block .= "<tr><td>$number</td><td>$name</td></tr>";

}

echo "<table border=\"1"><tr><td>Number</td><td>Name</td></tr>";
echo "$table_block"; 
?>

 

not sure where you wanted url, but where ever you want it, just put $url

not that I mean:

 

<?php

 

$query = mysql_query("SELECT name, url FROM games") or die(mysql_error());

 

while($row = mysql_fetch_row($query)) {

echo "&1={$row[0]}";

}

 

?>

 

and then it will show ten of the part in the array in it's own &1,&2 etc.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.