Error Resource Id #4
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Resource Id #4 Error In Php
of this site About Us Learn more about Stack Overflow the company Business resource id #8 error Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Mysql Resource Id 4
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: minecraft resource id Sign up Resource id #4 PHP MYSQL up vote -1 down vote favorite $result = mysql_query("SELECT indvsum.sum1 + indvsum.sum2 FROM (SELECT SUM(Cash) AS sum1, SUM(Bank) AS sum2 FROM players) indvsum"); echo $result; For some reason this is returning Resource id #4. How do I get the results of sum1 + sum2 returned? php mysql share|improve this question edited Jul 8 '12 at 21:10 resource id #3 bostaf 2,40921841 asked May 22 '12 at 15:01 user1307300 7124 1 the question is??? –bitoshi.n May 22 '12 at 15:05 add a comment| 6 Answers 6 active oldest votes up vote 1 down vote This is the expected behavior. Please check out the manual for some example about how to fetch rows: mysql_query This is the signature: resource mysql_query ( string $query [, resource $link_identifier = NULL ] ) For getting the rows you should use mysql_fetch_array or mysql_fetch_assoc for example. share|improve this answer answered May 22 '12 at 15:03 Peter Porfy 6,35621837 add a comment| up vote 1 down vote Because that's the standard output of mysql_query function. It returns the identifier related to that query. To get selected rows use mysql_fetch_array($result) or mysql_fetch_row($result) share|improve this answer answered May 22 '12 at 15:04 Akshat Goel 445416 add a comment| up vote 1 down vote Resource id #4 is being returned because $result is an array. As an example: $q_example = "SELECT indvsum.sum1 + indvsum.sum2 AS `aSUM` FROM (SELECT SUM(Cash) AS sum1, SUM(Bank) AS sum2 FROM players) indvsum"; $rsexample = mysql_query($q_example, $DB) or die(mysql_error());
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of
Resource Id #5
this site About Us Learn more about Stack Overflow the company Business resource id #2 Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Resource Id #6
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign http://stackoverflow.com/questions/10704670/resource-id-4-php-mysql up PHP Array Error: Resource id #4 [closed] up vote 0 down vote favorite The current issue I'm facing is that my MySql tables are not displaying when I type the url: www.mydoman.com/search-results.php?town=Blackpool - the results within the venuetbl aren't showing and print error is stating Resource id #4 http://stackoverflow.com/questions/14428051/php-array-error-resource-id-4 die("cannot select DB"); $res=mysql_query("SELECT * from venuetbl where town = '$town'") or die("error"); } ?>
echo $rows['name']; ?>
echo $rows['description']; ?>
View More Add To My Venues php mysql share|improve this question edited Jan 20 '13 at 19:01 Rudi Visser 13.8k43573 asked Jan 20 '13 at 18:58 user1867259 85 closed as too localized by Michael Berkowski, Sean Owen, RolandoMySQLDBA, tereško, t0mm13b Jan 21 '13 at 0:21 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. You are fetching into $row but in your loop you arehere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack http://stackoverflow.com/questions/11225423/sql-select-query-returning-resource-id-4 Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Sql select query returning Resource id #4 up vote -2 down vote favorite I wrote the following resource id code to select text from database,but when i echo the output it giving output as Resource id #4 mysql_select_db("xxxxx", $link); $q = "SELECT start_of FROM `qr_table` WHERE id_qr =1"; $result = mysql_query ($q, $link); echo $result; i am new to sql,forgive me if its a stupid questain Thanks in advance php sql share|improve this question asked Jun 27 '12 at 11:44 kze 225 7 Please, don't use mysql_* functions to resource id #4 write new code. They are no longer maintained and the community has begun deprecation process. See the red box? Instead you should learn about prepared statements and use either PDO or MySQLi. If you can't decide which, this article will help you. If you pick PDO, here is good tutorial. –tereško Jun 27 '12 at 11:47 Also .. please read the manual. –tereško Jun 27 '12 at 11:48 1 @tereško: thats a perfectly valid answer, why did you make it a comment? –Mizipzor Jun 27 '12 at 11:51 1 @mizipzor because, IMHO, it was not a valid answer. I think that any user with 4K+ reputations (thus, with rights to close questions), should put some effort into creating an answer. I actually tend to downvote trivial answers, if they are provided by high-rep users, who are just rep-whoring. –tereško Jun 27 '12 at 22:21 add a comment| 4 Answers 4 active oldest votes up vote 0 down vote accepted you are echoing out the connection. you need to do something with the results like loop through them please check http://www.php.net/manual/en/function.mysql-query.php share|improve this answer answered Jun 27 '12 at 11:47 Nicholas King 777620 add a comment| up vote 1 down vote I suggest you to read at least Php docume