To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Install

Install Conversation regarding installation and upgrade of PHP

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-28-2000, 04:45 PM   #1
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
This code seems to have an error

Can someone tell me if this code seems ok. Cause no one can edit their cv on our site. The site is programmed in PHP3. I have no one to help me please help
--------------------------------------------

if (($auth->auth["uid"] == $uid) || ($perm->have_perm("admin"))) {
$results = new CVDB;
$q = "DELETE from cv where rid='$rid'";
$results->query($q);

echo "<h2>Record Deleted</h2>
Please click <a href=\"$HTTP_REFERER\">here</a> to continue searching.<br>";
Anon is offline   Reply With Quote
Old 06-28-2000, 08:52 PM   #2
Anon
Senior Member
 
Join Date: Jun 2000
Posts: 65,386
RE: This code seems to have an error

We'd need more code to help out. A lot of what this code is doing is evidently in a class called CVDB, we'd need to take a look at the methods that class defines to get a good idea.

Off the top of my head, I'd say check the return value of your database query, e.g.

// ($return_value >0 if query succeeds)
if ($return_value = $result->query($q)) {
echo "<h2>deleted</h2>";
} else {
echo "<h2>Record not deleted</h2>";
// check database error string here
}
...

I don't know what database you're using, if it's mysql you should check the value of mysql_error($link_identifier), other DBs will have similar functions associated with them.

Given that you're using a class to access the DB, you might want to add an error() method to your database class of the form:

function error() {
return mysql_error($link_id);
}

and check the return value of that.

HTH,

AC






Anon is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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


All times are GMT -4. The time now is 05:52 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.