473,396 Members | 1,864 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,396 software developers and data experts.

read db error

anfetienne
424 256MB
i have this code that reads a database so i can echo specific things back to the page....i had help on it before and when i left the code it was working i go back to it to check it works and it wont display any values from the db on a page

here is the code

Expand|Select|Wrap|Line Numbers
  1. <?
  2. $errorM = '<div align="center"><h2><center>NOTE: Please make sure that you have saved your editorial before uploading any images.</center></h2></div>';
  3.  
  4. $user="********";
  5. $pass="********";
  6. $data="auctionTemps";
  7.  
  8. mysql_connect(localhost,$user,$pass);
  9.  
  10. @mysql_select_db($data) or die( "Unable to select database");
  11.  
  12. // Select column 1 from table name where column name = $your_var.
  13. $sql = "SELECT * FROM savedTemps WHERE tempID = '{$tempID}'";
  14. // If mysql_query returns false, we'll die with the error.
  15. $result = mysql_query( $sql ) or die( mysql_error );
  16.  
  17. // If a there is a match
  18. if ( mysql_num_rows( $result ) > 0 )
  19. {
  20. $row = mysql_fetch_array( $result );
  21.  
  22. }
  23.  
  24. else{
  25. echo $errorM;
  26. }
  27.  
  28. mysql_close();
  29. ?>
  30.  
I am using <? echo $row['title'];?> to show values to a page.....is something wrong? should it be print instead of echo?
Apr 29 '09 #1
4 1135
Markus
6,050 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. or die( mysql_error );
  2.  
  3. // should be:
  4. or die( mysql_error() );
  5.  
Do a print_r() on $row to see it's contents.
Apr 29 '09 #2
anfetienne
424 256MB
like this print_r($row)?
Apr 29 '09 #3
Markus
6,050 Expert 4TB
@anfetienne
yes .
Apr 29 '09 #4
anfetienne
424 256MB
ok thanks again markus
Apr 29 '09 #5

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

Similar topics

8
by: Gurk | last post by:
hi the settings of my program are stored in an ini file, is there a simple way to open the file in some textbox, ore a betteer soutable box. i also want it to be able to resave the ini so...
4
by: Bill Cohagan | last post by:
I'm writing a console app in c# and am encountering a strange problem. I'm trying to use redirection of the standard input stream to read input from a (xml) file. The following code snippet is from...
2
by: GB | last post by:
Hi Everybody! I have 2 different processes/application. One is writing to a file and another is reading from it. For some reason the code doesnt seems to work and gives mscorlib.dll IOException...
7
by: JerryW | last post by:
I just reinstalled .NET 2003 (after repeated attempts to get ASP.NET Web Applications to work). I first did a complete uninstall of .NET 2003, .NET Framework 1.1, and IIS. I also completely deleted...
17
by: ronaldlee | last post by:
I have this error in Line 89. Collection is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more...
6
by: Samuel M. Smith | last post by:
I have been playing around with a subclass of dict wrt a recipe for setting dict items using attribute syntax. The dict class has some read only attributes that generate an exception if I try to...
4
by: Peter Rothenbuecher | last post by:
Hello, when I try to compile the following code: /* This fragment of code is taken from an online tutorial */ #include<stdio.h> #include<fcntl.h> #include<stdlib.h> float bigbuff;
4
by: rowan | last post by:
I'm writing a driver in Python for an old fashioned piece of serial equipment. Currently I'm using the USPP serial module. From what I can see all the serial modules seem to set the timeout when...
7
by: capnwhit | last post by:
Hello all, The program below has a bug... The program is supposed to convert a string to a continuous hex dump and back to a string. The output should be as follows: abcd 61626364 abcd
3
by: dizzylizzyd514 | last post by:
void get_workdata(ifstream& in, emp_rec anc_emp, int n) { int x; double y; int cnt = 0; for (int i=0; i<n; i++) { anc_emp.hoursworked = 0.0; anc_emp.commission = 0.0; ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.