Go Back   HTMLCenter Web Development Forums > Web Design and Development > Databases

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-15-2008, 11:26 AM
Registered User
 
Join Date: Jul 2004
Posts: 223
no update made and no table created

I don't understand why no updating is taking effect and no table is created:
PHP Code:
include("../files/constants.php");
include(
"../files/dbconnection.php");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db($acronym."_book"$con);
$sql "SELECT * FROM ".$acronym."_pages WHERE content LIKE '%nbsp%'";
$result mysql_query($sql) OR exit( 'Error: ' mysql_error() );
    
//echo $sql;
    //to keep record of what changes are made I decided to create a table
    
$sql_record "CREATE TABLE ".$acronym."_correction_nbsp
    (
    cor_ID int(6) NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(cor_ID),
    content_before longtext,
    content_after longtext
    )"
;
    while(
$row mysql_fetch_array($result)){
        
$new preg_replace('#&?nbsp;?#i'' '$row['content']);
        if(
$row['content'] != ""){
        
$sql_record2 "INSERT INTO correction_nbsp (content_before, content_after)
        VALUES ("
.$row['content'].", ".$new.")";
        echo 
$sql_record2."<br />\n";
        }        
        
$sql2 "UPDATE ".$acronym."_pages SET content = '".$new."' WHERE content = '".$row['content']."'";
        echo 
$sql2."<br />\n";
    }
mysql_close($con); 
If you want to simply view the statements here are a few examples:
Code:
INSERT INTO correction_nbsp (content_before, content_after) VALUES ( CHAPTER 1  ,  CHAPTER 1  )
UPDATE bwas_pages SET content = ' CHAPTER 1  ' WHERE content = ' CHAPTER 1  '
INSERT INTO correction_nbsp (content_before, content_after) VALUES ( , )
UPDATE bwas_pages SET content = ' ' WHERE content = ' '
INSERT INTO correction_nbsp (content_before, content_after) VALUES ( , )
UPDATE bwas_pages SET content = ' ' WHERE content = ' '
INSERT INTO correction_nbsp (content_before, content_after) VALUES (chapter: , chapter: )
UPDATE bwas_pages SET content = 'chapter: ' WHERE content = 'chapter: '
INSERT INTO correction_nbsp (content_before, content_after) VALUES (copies  &nbspfrom  &nbspauthoritative  &nbspsources  &nbspshowing  &nbspthe , copies from authoritative sources showing the )
Reply With Quote

Reply


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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Way For Writers To Update? sirtech Programming and Scripting 9 04-02-2007 08:22 PM
Copying Only Unique Records From One Table To Another curtiss Databases 2 10-27-2006 03:20 AM
CSS & TABLE 1+1=3??? seccondbest Programming and Scripting 9 11-24-2005 02:27 AM


All times are GMT -5. The time now is 02:33 AM.

 
KickApps
Clicky Web Analytics


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter