Page 1 of 1

[help] mysql i guess?

Posted: Wed Jun 09, 2004 10:07 am
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 #"

Posted: Wed Jun 09, 2004 10:11 am
by dull1554
it's not saving it as you think search the forums for resource id error

Posted: Wed Jun 09, 2004 10:13 am
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);

Posted: Wed Jun 09, 2004 10:18 am
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', '')");

Posted: Wed Jun 09, 2004 10:24 am
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.