Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 23rd, 2000, 10:14 AM
cmatrix cmatrix is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 24 cmatrix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cmatrix
Hi,

I am having a problem with a php/mysql image
gallery that I am working on. These 3 lines of code appear to work but everytime the event_id obtained is equal to 2 which is not the case, the event_id variable in the events_gallery table autoincrements starting at 1 but even with 1 entry in the table the event_id obtained using php is 2. The codes is below...

mysql_query ("INSERT INTO events_gallery VALUES ('$add_event_name', '$img_name', null)");

$sql = "SELECT ID from events_gallery WHERE (event_name = '$add_event_name')";

$event_id = mysql_query($sql);

If i do the same query through telnet I get the correct values using the same SQL statement that im using in php so i have no idea what the problem is... any ideas?

Reply With Quote
  #2  
Old June 23rd, 2000, 11:04 AM
cmatrix cmatrix is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 24 cmatrix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cmatrix
Ok i put that project on hold and went back to another php/mysql thing i was doing (querying a database for event/info) and ran into another differnt but mayb similar problem. I have dates stored in a mysql database of the form yyyy-mm-dd format and im trying to use the date_format function in mysql to convert them then display the result using php. Ive done this using the following code:

$sql = "select date_format('$temp2','%W %M %D, %Y')";
$temp = mysql_query($sql);
print("$temp");

But once again the commands return the proper results when typing the SQL into telnet but the results are "3:" "4:" etc... when called using the code above. I'm not sure what the problem is. Any help would be apprecaited... thanks in advance!

Reply With Quote
  #3  
Old November 21st, 2000, 01:07 PM
yves yves is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Posts: 1 yves User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to yves
ok, cmatrix, i had the same problem and in the meantime you figured it out and helped me that way. i will tell the solution here if anybody else will get into the same problems.
Use:


<?php
$temp2 = "2000-01-04";
$sql = "select date_format('$temp2','%W %M %D, %Y')";
$temp = mysql_query($sql);
$temp_date = mysql_fetch_row($temp);
echo($temp_date[0]);
?>

URL credits go to cmatrix, thanx for helping me,
yves.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > php problem?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway