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!

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

<?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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

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