[help] mysql i guess?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

[help] mysql i guess?

Post by bla5e »

::form::

Code: Select all

if ($_GET['add'] == 'dl') {
?>

<form name="form6" method="post" action="dl_add.php">

    </td>
	<td width="25%">files/
      <input name="link" type="text" size="35" maxlength="25">
    </td>

  </tr>
</table>
<input type="submit" name="Submit" value="Add">
<input type="reset" name="Submit2" value="Cancel">
   
</form>

::submit form::

Code: Select all

<?php
include ("config.php");

$open = mysql_connect($db_serv, $db_user, $db_pass);

$scud = mysql_db_query($db_bas , 'SELECT * FROM cheats');

mysql_query("INSERT INTO `cheats` (`date`, `name`, `link`, `info`, `cdproof`, `vacproof`, `id`)VALUES ('$date', '$name', '$link', '$info', '$cdproof', '$vacproof', '')");
?>


for the link part, any clue why it would save it as "Resource ID #1"?

everything else works, but it saves the link part as "Resource ID #"
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

it's not saving it as you think search the forums for resource id error
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Not sure what 'link part' refers to, but i'm guessing it's something to do with $scud?
After doing $scud = mysql_db_query($db_bas , 'SELECT * FROM cheats'); you'll need to do a mysql_fetch_* call, something like, $results = mysql_fetch_assoc($scud);
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post by bla5e »

markl999 wrote:Not sure what 'link part' refers to

Code: Select all

<input name="link" type="text" size="35" maxlength="25">
and

Code: Select all

mysql_query("INSERT INTO `cheats` (`date`, `name`, `link`, `info`, `cdproof`, `vacproof`, `id`)VALUES ('$date', '$name', '$link', '$info', '$cdproof', '$vacproof', '')");
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Hmm, if it's putting 'Resource ID #1' into the link column of the database then i'm guessing $link is defined somewhere as the db link, $link = mysql_connect .. etc.

Also, the code would require register_globals to be On otherwise $link won't be set. Rather than turn globals On (if they are off) you should use '{$_POST['link']}' in the query instead of '$link', this should stop it using the db link as the value.
Post Reply