473,405 Members | 2,310 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,405 software developers and data experts.

MySQL result resource error

40
Hi everyone,

I have a form which updates some info in a DB. Currently the user does a search, which will load up results, which the user can change, and then submit those changes back into the DB.

I'm attempting to make it that after submitting data successfully that the search results load back up right away, so the user doesn't have to put in search criteria again.

Results are held in a $result variable :
Expand|Select|Wrap|Line Numbers
  1. $result = search($_POST['f_name'], $_POST['l_name'], $_POST['sub'], $_POST['des'], $_POST['id'], $_POST['u_id'], $cat, $s_date, $e_date);
$result is then passed to a function edit_tables($result) where I print out the data in forms which the user can edit.

Before I iterate through $result I pass it into another variable, which i then pass along as a $_POST variable (lets call it new_result) as the user hits submit which sends the data into another function which actually updates in the information.

My problem is that if I echo my $_POST['new_result'] it gives me "Resource ID#6" which is my expected result, but if I now try to traverse that Resource ID by passing it back into my edit_tables function, I get the error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /web/apache/htdocs/folder/folder/dev/file.php on line 46

Can anyone point out what I'm doing wrong or recommended a better way to do this?
Dec 5 '08 #1
3 2250
Atli
5,058 Expert 4TB
Hi.

This "Resource ID #", are you printing it into the HTML to be re-submitted to another page?

If so, keep in mind that when a mysql_query call returns a result object, the object is used to fetch the data. What you get from printing it ("Resource ID #") is just a string PHP uses to show you what the object is.

Once the code has been executed and the output sent to the client, the resource your mysql_query call returned no longer exists. What you put into the form is now just a string and can not be used to access those results anymore.

You need to query them again in the second page.
Dec 6 '08 #2
BOMEz
40
So pretty much I'm just really passing along a string.

I think I got

Thanks for the reply. I'm moving onto an entirely different strategy
Dec 12 '08 #3
Atli
5,058 Expert 4TB
Good luck! :)
Let us know if you need help with you new strategy.
Dec 12 '08 #4

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

Similar topics

6
by: jerrygarciuh | last post by:
Hi all, I am iterating through a result set to generate a second set of queries but no matter what I do I get the error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result...
2
by: Noel Wood | last post by:
Hello I keep getting a warning ... Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in "name of my php file" when I run this query.... SELECT Menu_Item,...
5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
3
by: Klaus Hansen | last post by:
Hi all Using Windows XP, PHP4.3.11 and Mysql 4.1. Im a newbie to PHP and Mysql. Im trying to connect to the database with this script: <?php //list_db.php
9
by: Petr Vileta | last post by:
Hi, I'm new here and excuse me if this question was be here earlier. I have a simple code <html><body> <?php <?php $link = mysql_connect("localhost", "user", "password") or die("Grr: " ....
1
by: lsmamadele | last post by:
I am getting the following error messages in my search: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on...
21
by: bruno_guedesav | last post by:
I've made a function to fetch all results as an array of result- arrays. Getting the result arrays is easy, via mysql_fetch_array, and function itself is quite simple, as follows: function...
10
by: Caffeneide | last post by:
I'm using a php script which performs three xml queries to other three servers to retrieve a set of ids and after I do a query to mysql of the kind SELECT * FROM table WHERE id IN ('set of ids');...
3
by: thesmithman | last post by:
Well, actually, I'm sure it's my code... I have a basic nested query: $query="INSERT INTO items (blah, blah, blah) VALUES ('$blah', '$blahblah', NULL)"; $result=mysql_query($query) or...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.