Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-01-2008, 06:17 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 886
Last Blog:
Programming "Just a ...
Rep Power: 9
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default query wont insert?

ok, so I dont understand why this script isnt working..

PHP Code:
                    if(isset($ASP)){ $ASP "yes"; } Else { $ASP "no"; }
                    if(isset(
$PHP)){ $PHP "yes"; } Else { $PHP "no"; }
                    if(isset(
$java)){ $java "yes"; } Else { $java "no"; }
                    if(isset(
$python)){ $python "yes"; } Else { $python "no"; }
                    if(isset(
$perl)){ $perl "yes"; } Else { $perl "no"; }
                    if(isset(
$JDK)){ $JDK "yes"; } Else { $JDK "no"; }
                    if(isset(
$flash)){ $flash "yes"; } Else { $flash "no"; }
                    if(isset(
$ruby)){ $ruby "yes"; } Else { $ruby "no"; }
                    if(isset(
$tomcat)){ $tomcat "yes"; } Else { $tomcat "no"; }
                    if(isset(
$SSI)){ $SSI "yes"; } Else { $SSI "no"; }
                    if(isset(
$CGI)){ $CGI "yes"; } Else { $CGI "no"; }
                    if(isset(
$cpanel)){ $cpanel "yes"; } Else { $cpanel "no"; }
                    if(isset(
$SQL)){ $SQL "yes"; } Else { $SQL "no"; }
                    if(isset(
$emails)){ $emails "yes"; } Else { $emails "no"; }
                    if(isset(
$subdomains)){ $subdomains "yes"; } Else { $subdomains "no"; }
                    if(isset(
$SSH)){ $SSH "yes"; } Else { $SSH "no"; }
                    if(isset(
$sitebuilder)){ $sitebuilder "yes"; } Else { $sitebuilder "no"; }
                    
$date date("m.d.y"); 
                    
$query="UPDATE webmasters SET hostemail='$newhostemail', hosttitle='$newhosttitle', hosturl='$newhosturl', profile='$newprofile', OS='$newOS', PHP='$PHP', ASP='$ASP', java='$java', python='$python', JDK='$JDK', flash='$flash', ruby='$ruby', tomcat='$tomcat', SSI='$SSI', CGI='$CGI', cpanel='$cpanel', SQL='$SQL', emails='$emails', subdomains='$subdomains', SSH='$SSH', sitebuilder='$sitebuilder', lastupdated='$date', WHERE id='$id'";
                    
mysql_query($query);
                    
                    
$noticetitle "Success";
                    
$noticedata "Your Profile Has Been Updated";
                    
$refresh "index.php?action=viewhost&hostid=$id";
                    include(
"notice.php"); 
It will say success, your profile has been updated, but wont update, or give me an SQL error, do you guys see something wrong with it? I feel stupid asking
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-01-2008, 06:42 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: query wont insert?

Instead of mysql_query($query); try:

PHP Code:
mysql_query($query) or die('Error in query: '.$query.' : '.mysql_error($connection)); 

and see if MySQL throws an error.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!

Last edited by Jordan; 05-01-2008 at 06:46 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-01-2008, 07:55 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 886
Last Blog:
Programming "Just a ...
Rep Power: 9
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: query wont insert?

awesome.. I see the error. its adding the HTML and throwing an error (I believe)

Quote:
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/analyzet/public_html/editprofile.php on line 149
Error in query: UPDATE webmasters SET hostemail='support@analyzethathost.com', hosttitle='Digital Euphoria', hosturl='http://google.com', profile='


The greatest profile ever!\\\'\\\'\\\"\\\"$username', OS='lincentos5', PHP='yes', ASP='yes', java='yes', python='yes', JDK='yes', flash='yes', ruby='yes', tomcat='yes', SSI='yes', CGI='yes', cpanel='yes', SQL='yes', emails='yes', subdomains='yes', SSH='yes', sitebuilder='yes', lastupdated='05.01.08', WHERE id='1' :
addshashes isnt working..
how do I add HTML into an SQL field?

EDIT: after Profile='
there is a ton of HTML, just wont show on codecall

Last edited by phpforfun; 05-01-2008 at 07:56 PM. Reason: edit
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-01-2008, 09:15 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: query wont insert?

Use the htmlentities() function on the string:

IE:
PHP Code:
$profile htmlentities($profile); 
Before you insert it into the DB. You can read more about the function here: PHP: htmlentities - Manual
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-01-2008, 09:37 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 886
Last Blog:
Programming "Just a ...
Rep Power: 9
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: query wont insert?

That doesnt seem to work, but I will work with it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 05-02-2008, 12:38 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: query wont insert?

Turn magic quotes off [they wont exist in php 6], and prior to inserting strings into the database, run them through mysql_real_escape_string(). Don't bother with htmlentities, adding or stripping slashes before inserting html into a database. Worry about them when you display the html.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-02-2008, 04:10 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 886
Last Blog:
Programming "Just a ...
Rep Power: 9
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: query wont insert?

Hum.. I tried that too john, doesnt work..

feel free to log in and test it.

Analyze That Host
click login
use "Justin" and "pass"
after you login, hover over "member actions" (where login was), and click edit host profile

and then just edit whatever

here is the code
PHP Code:
                    $newprofile mysql_real_escape_string($newprofile);
                    
$query="UPDATE webmasters SET hostemail='$newhostemail', hosttitle='$newhosttitle', hosturl='$newurl', profile='$newprofile', OS='$newOS', PHP='$PHP', ASP='$ASP', java='$java', python='$python', JDK='$JDK', flash='$flash', ruby='$ruby', tomcat='$tomcat', SSI='$SSI', CGI='$CGI', cpanel='$cpanel', SQL='$SQL', emails='$emails', subdomains='$subdomains', SSH='$SSH', sitebuilder='$sitebuilder', lastupdated='$date', WHERE id='$id'";
                    
mysql_query($query) or die('Error in query: '.$query.' : '.mysql_error($connection));  
                    
                    
$noticetitle "Success";
                    
$noticedata "Your Profile Has Been Updated";
                    
$refresh "index.php?action=viewhost&hostid=$id";
                    include(
"notice.php"); 

EDIT: The sql type is set as "text", is that ok?

Last edited by phpforfun; 05-02-2008 at 04:16 PM. Reason: sql stuff
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-02-2008, 05:25 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,203
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: query wont insert?

I was hoping John would reply to this thread. When you run John's suggestion, do you get the same MySQL error?
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-02-2008, 06:23 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 886
Last Blog:
Programming "Just a ...
Rep Power: 9
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: query wont insert?

yeah i do

why were you hoping he would reply?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 05-02-2008, 10:47 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: query wont insert?

I will have a look at this more closely in a few hours. PM me where this file is located on your account, so I can have a closer look.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump