mysql fetch array prob (again)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Absolutely no problem.

I would recommend you check out these tutorials, or even check out my site which has a list of tutorials on it.

http://www.vtwebwizard.com/tutorials/mysql/start.php

http://www.mysql.com/articles/ddws/

http://www.onlamp.com/php/
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

new problem:(
i need to make a link... but... it gives me an error...i have...

$row = mysql_fetch_array($result);
$name = $row["name"];
$mname = $row["mname"];
$dis = $row["discription"];
$dl = $row["dllink"];

(+ the other stuff you showed me to put)
so i tryed to make a link like...

<?php <a href="print $dl">print "$mname"</a> ?>

and it says error on line 38...

any help please?
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

i also tryed <a href="<? php echo $row[dllink]; ?>"><?php echo $row[mname]; ?></a>
still nothing :cry:
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

First change your result variable to:

Code: Select all

$result = mysql_query("select * from maps");
Then when you want to print the link:
<a href="<?php print $row['dllink']; ?>">LINK NAME</a>
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

but what about that id deal?

and i actually have exactly that? dont change any of it?
$result = mysql_query("select * from maps");

if i dont have the id deal then i cant easily make new pages?
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

ok... i found out that i CAN use the id deal... and now i have a new question... lol im full of questions... anywayz...
i want to have multiple pages generated from 1 page(the layout page...)
i need a script so i can go to http://www.triggerhappycheaters.com/map ... 1.php?id=1
and when id changes, that changes the info that comes up for the $ statment deals...

help is much appreciated
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Well that shouldn't be hard at all. If the table maps has a field titled ID then you should be able to do:

Code: Select all

$id = $_GET&#1111;'id']; // Put this somewhere above the declaration of $result

$result = mysql_query("select * from maps where id='$id'");
You should also read those tutorials I linked you to...
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

I was assuming that the connection to the db was made but your right nigma I must have missed something in the post.

phpScott
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Yea, sorry, I didn't mean to nit pick the hell out of you.
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

thx!
they should call you the PHP god :o
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

think u could add me to msn or sompting? my email is ricerocket500@msn.com
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Just added you ;)
weasel
Forum Commoner
Posts: 27
Joined: Sat Aug 16, 2003 3:27 pm

Post by weasel »

saw that... its saying your not :? on msn
Post Reply