shedokan Posted June 2, 2007 Share Posted June 2, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/ Share on other sites More sharing options...
shedokan Posted June 2, 2007 Author Share Posted June 2, 2007 so can someone help me? Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267104 Share on other sites More sharing options...
penguin0 Posted June 2, 2007 Share Posted June 2, 2007 we need to know a little bit more information. What is the table name and variables that you will or already use? Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267109 Share on other sites More sharing options...
shedokan Posted June 2, 2007 Author Share Posted June 2, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267134 Share on other sites More sharing options...
sebastiaandraaisma Posted June 2, 2007 Share Posted June 2, 2007 Are you able to connect to your database and do you have the right database selected? What code do you use inside your php file? If you can paste it here that would help a lot Kind regards, Sebastissn Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267143 Share on other sites More sharing options...
chigley Posted June 2, 2007 Share Posted June 2, 2007 <?php $query = mysql_query("SELECT name, url FROM games") or die(mysql_error()); while($row = mysql_fetch_row($query)) { echo "<a href=\"{$row[1]}\">{$row[0]}</a><br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267152 Share on other sites More sharing options...
penguin0 Posted June 3, 2007 Share Posted June 3, 2007 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267211 Share on other sites More sharing options...
shedokan Posted June 3, 2007 Author Share Posted June 3, 2007 thanks it's just what I needed and one last question, ask the question here or create a new thread? Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267404 Share on other sites More sharing options...
chigley Posted June 3, 2007 Share Posted June 3, 2007 Depends how relevant it is really, up to you Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267407 Share on other sites More sharing options...
shedokan Posted June 3, 2007 Author Share Posted June 3, 2007 I have another part of the table called number and I want to show top ten from all of the table and order them by the number the biggest number on top. Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267449 Share on other sites More sharing options...
chigley Posted June 3, 2007 Share Posted June 3, 2007 SELECT numberfield FROM number ORDER BY numberfield ASC LIMIT 10 Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-267472 Share on other sites More sharing options...
shedokan Posted June 7, 2007 Author Share Posted June 7, 2007 how can I select 5 tables in the same time and take ten of them and order them by the biggest number in a field Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-269874 Share on other sites More sharing options...
shedokan Posted June 9, 2007 Author Share Posted June 9, 2007 don't think on my last post. I know how to do this but how can I pass those stuff into flash I mean like top ten games into flash. thanks Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-271301 Share on other sites More sharing options...
chigley Posted June 9, 2007 Share Posted June 9, 2007 That leads into Actionscript. You need to make your PHP files echo out the variables, and make the Actionscript in the flash code read the PHP file. Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-271303 Share on other sites More sharing options...
shedokan Posted June 9, 2007 Author Share Posted June 9, 2007 I know the part of flash but the part of the php is tricky because I need php to echo each part of the my sql array into other name like this: echo "&1=$array['array']; echo "&2=$array['array3']; Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-271323 Share on other sites More sharing options...
chigley Posted June 9, 2007 Share Posted June 9, 2007 $output = "1={$value1}"; $output .= "&2={$value2}"; $output .= "&3={$value3}"; Not complicated.. Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-271324 Share on other sites More sharing options...
shedokan Posted June 9, 2007 Author Share Posted June 9, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/54021-can-i-get-some-help-about-php-and-mysql-interation/#findComment-271328 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.