MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 25th, 2003, 08:37 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
store image locations in mysql db for gallery pt 2

my posts were being truncated so I'm starting a new thread, the old thread is located here .

I'm getting errors from this line:

[php]echo "<input name='ID' type='hidden' value='$ID'>

Reply With Quote
  #2  
Old June 25th, 2003, 08:44 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
arrggghhh

dam dam dam dam dam dam dam dam dam dam dam dam dam dam dam dam dam dam

why does'nt it work ?

Reply With Quote
  #3  
Old June 25th, 2003, 09:37 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
I'm getting errors from this line:

[php]echo "<input name='ID' type='hidden' value='$ID'>

Reply With Quote
  #4  
Old June 25th, 2003, 09:38 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
errors

not just on with the script but also with this site ?? this is really a very strange line of code to cause such havoc !

Jon

Reply With Quote
  #5  
Old June 25th, 2003, 09:39 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
testing

I'm getting errors from this line:

PHP Code:
echo "<input name='ID' type='hidden' value='$ID'> 

Reply With Quote
  #6  
Old June 25th, 2003, 09:40 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
and again...

PHP Code:
<?php

/*

    editcaption.php
    updates a caption from a specific row in the gallery table
    
*/

// Define database connection details

include "./db.inc.php";

echo 
$action;

if(
$action == 'getCaption')
{
    
    echo 
"<br>this is getCaption!<br><br>\n";
    
    
// Attempt to connect to MySQL server
    
$link mysql_connect($dbHost ,$dbUser ,$dbPass ) or die( "An error has ocured: " .mysql_error (). ":" .mysql_errno ());
        
    
$dbconnect mysql_select_db($dbName);
        
    
// setup MySQL query
    
$query "SELECT caption FROM gallery WHERE imageID = '$ID'";

    
// Execute Query
    
$result mysql_query($query) or die( "An error has ocured: " .mysql_error (). ":" .mysql_errno ());

    if(
result)
    {

        
$row mysql_fetch_assoc($result);

        
$caption $row["caption"];
        
        
// set up header file
        
include "./html/header.php";

        echo 
"<form name='form1' method='post' action='editcaption.php'>\n";
        echo 
"<textarea name='newCaption' cols='40' rows='7'>$caption</textarea><br>\n";
        echo 
"<input name='ID' type='hidden' value='$ID'>



continues in next post...

Reply With Quote
  #7  
Old June 25th, 2003, 09:41 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
continued from last post

PHP Code:
else if ($action == 'update')
{
    echo 
"<br>this is update!<br><br>\n";
    
    
$newCaption $_POST['newCaption'];
    
$ID $_POST['ID'];
    
    echo 
$newCaption;
    
    
// Attempt to connect to MySQL server
    
$link mysql_connect($dbHost ,$dbUser ,$dbPass ) or die( "An error has ocured: " .mysql_error (). ":" .mysql_errno ());
        
    
$dbconnect mysql_select_db($dbName);
        
    
// setup MySQL query
    
$query "UPDATE gallery SET caption = '$newCaption' WHERE imageID = '$ID'";

    
// Execute Query
    
$result mysql_query($query) or die( "An error has ocured: " .mysql_error (). ":" .mysql_errno ());
    
    if(
result)
    {
        echo 
"caption updated";
    }
    else
    {
        echo 
"error";
    }
}

?> 

Reply With Quote
  #8  
Old June 25th, 2003, 09:48 AM
_rainbow_ _rainbow_ is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Lj, Slovenia
Posts: 27 _rainbow_ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 28 sec
Reputation Power: 0
It think you just forgot the double quote and ; at the end of that line. If this is actually the correct post

PHP Code:
echo"<input*name='ID'*type='hidden'*value='$ID'>"


But something tells me that isn't the real problem at hand.

Reply With Quote
  #9  
Old June 25th, 2003, 09:55 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
rainbow,

In the end, I decided to remove those hidden fields all together and use them in the url string...

PHP Code:
echo "<form name='form1' method='post' action='editcaption.php?action=update&ID=$ID'>\n"


It's sorted now, thanks for all your help mate, I will be no doubt asking for it again very soon when I move onto the news page!.

Jon

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > store image locations in mysql db for gallery pt 2


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT