Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-23-2004, 08:39 AM
varg
Unregistered

Posts: n/a

fetch maps from phpMapDb

I am re-doing my site / front page mostly, and I was wondering if there is a way to fetch the latest 5 maps submitted to the php mapdb, to the front page, their names and download id should be more than ennough.

Could you scott, or someone else please help me with this?
Reply With Quote
  #2  
Old 11-24-2004, 07:40 PM
PHP-Largo
Unregistered

Posts: n/a

yeah now i'm not sure what the set up is but here is how it will sort of go ...
[code:1:ffb6db778e]
<?

//Connect To DB
$connect = ("mysql_host","mysql_username" ,"mysql_password")
or die("Map Data Base Currently Offline!");
//chose database
mysql_select_db("whateverdb","$conn ect")
or die("Map Data Base Currently Offline!");

//Query The mysql_db
$query = mysql_query("SELECT * FROM tablename ORDER BY id_name DESC LIMIT 10");
//fetch data in array
while($myrow=mysql_fetch_array($query)){
echo" bla bla bla <a href=\"$myrow[map_download_link]\">$m yrow[map_name]</a> bla bla ";
}

exit;
?>[/code:1:ffb6db778e]
Now if i owned the script i could actually give out names , and what not bu it don't so hopefuly you can edit it to do what you like.
Reply With Quote
  #3  
Old 11-26-2004, 11:08 AM
varg
Unregistered

Posts: n/a

Thanks alot, I got a few errors, but after some tweaking I got rid of them.
But there's one I can't seem to work out: "
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/varg/public_html/index9.php on line 130"

the code im using:
[code:1:f584782ce0]<?

//Connect To DB
$dbh=mysql_connect (localhost, myusername, mypass)
or die("Map Data Base Currently Offline!");
//chose database
mysql_select_db(varg_mapdb,$dbh)
or die("Map Data Base Currently Offline!");

//Query The mysql_db
$query = mysql_query("SELECT * FROM phmapdb_maps LIMIT 10 ORDER BY mid DESC");
//fetch data in array
while($myrow = mysql_fetch_array($query)){
echo"<a href=\"$myrow[map_download_link]\">$m yrow[map_name]</a>";
}

exit;
?>
//(line 130 : while($myrow = mysql_fetch_array($query)){ )

[/code:1:f584782ce0]

Any ideas?
Reply With Quote
  #4  
Old 11-27-2004, 09:40 PM
PHP-Largo
Unregistered

Posts: n/a

it means your not pulling out something that's there, in other words what your trying to pull out is not there, make it case sensitive, and be sure to make sure names and all are good .... if i owned the script i could help out a lil better lol .
Reply With Quote
  #5  
Old 12-23-2004, 05:49 PM
varg
Unregistered

Posts: n/a

yo scott, can you help out here?
what should this line be??

[color=darkred:f42d4caa98]$query = mysql_query("SELECT * FROM [/color:f42d4caa98][color=red:f42d4caa98] phmapdb_maps[/color:f42d4caa98][color=darkred:f42d4caa98] LIMIT 10 ORDER BY [/color:f42d4caa98][color=red:f42d4caa98]mid [/color:f42d4caa98][color=darkred:f42d4caa98]DESC");[/color:f42d4caa98]

This is the last thing I need to have my site as I want it.. (http://mapmakersheaven.com)

//EDIT:
haha I figured it out myself, and it works great.

here's the line, in case someone else needs it:
[color=darkred:f42d4caa98]$query = mysql_query("SELECT mid,mname FROM phmapdb_maps ORDER BY mid DESC LIMIT 5");[/color:f42d4caa98]
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Coverting npj maps 2 mis maps the teacher Joint Operations 0 05-31-2007 10:13 PM
permission to add maps to our maps db SSBUILD General Chat 2 03-14-2005 04:51 PM
Link counter + phpMapdb varg phphq.Net Forums 0 10-28-2004 06:41 PM
Incorporating TFD DM,SD, KOTH maps into TDM maps tc.iyaayas Delta Force 6 12-14-2002 09:26 AM
20 New DF:LW Maps, DF:TFD maps tomorrow! Scott News 0 07-01-2002 11:39 AM


All times are GMT -5. The time now is 10:26 AM.




Powered by vBulletin®