473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

MySQL-Link resource not valid

I get this error:

Warning: mysql_query(): 3 is not a valid MySQL-Link resource in C:\xampp\htdocs\Admin\deleteuser.php on line 19

And my script is:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include ('sqlcon.php');
  3. mysql_select_db("shop",$conn);
  4.  
  5. global $conn;
  6. $id = $_POST[id];
  7.  echo $id;
  8. include('users.php');
  9.  
  10. if ($_POST['delete'])
  11. {
  12.     echo 'delete'; 
  13.     mysql_query("DELETE FROM test WHERE id=$id",$conn);
  14.     } 
  15.  
  16. else if ($_POST['info'])
  17.  {
  18.     echo 'info'; 
  19.     $last = mysql_query("SELECT lastname FROM test WHERE id=$id",$conn) or die(mysql_error());
  20.     echo $last;
  21.     }
  22.  
  23. $thispage = $_SERVER['PHP_SELF'];
  24. $form_page = <<< EOFORMPAGE
  25.  
  26. <body>
  27.  
  28. <form method="POST" action="--WEBBOT-SELF--">
  29.     <p><input type="text" name="T1" value="$last"size="20"></p>
  30. </form>
  31.  
  32. </body>
  33.  
  34.  
  35. EOFORMPAGE;
  36. echo $form_page;
  37. ?>
  38.  
thanx for help.
Mar 14 '10 #1
6 2118
Markus
6,050 Expert 4TB
Please see this article written by Atli.
Mar 14 '10 #2
Article didn't helped for me... maby somedody can show an example of working code, or fix this?
Mar 15 '10 #3
Your connection is invalid. The article Markus posted the link to does contain your answer you just didn't read it.

"1.1. MySQL "link" resources
These tell PHP how to communicate with MySQL.

When you call mysql_connect, PHP opens a connection to the MySQL server. If successful, the connection is opened and the connection details are stored in memory. The "mysql_link" resource is a link to the memory location where those details are stored."
Mar 15 '10 #4
I have chaged my script abit, now i get another error..

Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in C:\xampp\htdocs\Admin\deleteuser.php on line 23

I have changed this:
$last = mysql_query("SELECT lastname FROM test WHERE id=$id",$conn) or die(mysql_error());
to this:

$getinfo = "SELECT lastname FROM test WHERE id=$id";
while ($myrow = mysql_fetch_array($getinfo))
{
$last = $myrow["lastname"];
}
i don't understand this..
Mar 15 '10 #5
Markus
6,050 Expert 4TB
I suggest you take a look at some MySQL & PHP tutorials.
Mar 15 '10 #6
Your no longer preforming a query meaning you have no result for mysql to fetch an array from it's a database not magic can't really pluck things out of the air.

Agree with Markus but I recommend tutorialspoint.com and w3schools.com I would rate tizag.com third though.
Mar 16 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: francescomoi | last post by:
Hi. I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2: ---------------------------------- # export PATH=$PATH:/usr/local/mysql/bin/ # export mysqlclient=mysqlclient_r # python setup.py...
4
by: mikey | last post by:
Hi all, I'm having great problems trying to install the latest MySQl RPM package onto my Red Hat Linux OS. There is already MySQL v 3.0 pre-installed with the RH Linux distribution disk but I...
0
by: Yun Guan | last post by:
Hello mysql gurus, I am trying to run perl on mysql database on Red Hat box. I want to install DBI and DBD:mysql using CPAN: perl -MCPAN -e shell cpan>install DBI The above succeeded, but...
2
by: Saqib Ali | last post by:
I installed mySQL and have it running.... but I think I made a mistake somewhere along the line...... I believe I did follow the instructions that were provided with the distribution at:...
1
by: Alex Hunsley | last post by:
I am trying to install the DBD::mysql perl module. However, it claims I need mysql.h: cpan> install DBD::mysql CPAN: Storable loaded ok Going to read /home/alex/.cpan/Metadata Database was...
0
by: ./Rob & | last post by:
Hi gang: I'm experiencing a problem with MySQL -- I updated MySQL from version 4.1.0 to 4.1.10 and now when I login as root it doesn't show all the databases I should have access to, nor it...
2
by: trihanhcie | last post by:
I m currently working on a Unix server with a fedora 3 as an os My current version of mysql is 3.23.58. I'd like to upgrade the version to 5.0.18. After downloading from MYSQL.COM the package on...
1
by: manish deshpande | last post by:
Hi, When i'm installing MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm by the following command: rpm -i MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm the following error is being shown: ...
3
by: menzies | last post by:
Hi, I"m new to this forum, but I have been trying all day to install DBD::mysql onto my Intel MacBook. I've read lots of forums pages and none have gotten me to a successful 'make test' or a...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.