 |
 |
 |
 |
 |
| Author |
Message |
BadDog
Joined: 21 Nov 2005 Posts: 62
|
|
Some mySQL syntax that can lead to broken code |
|
I have a few suggestions for correcting some bugs here, mainly have to do with mySQL syntax that breaks under current mySQL versions. Example, comments were not being added because of this code:
 |  |
$sql->insert(array(
'table' => 'comments',
'values' => array(
'post_id' => $id,
'date' => $time,
'author' => $name,
'mail' => $mail,
'ip' => $_SERVER['REMOTE_ADDR'],
'comment' => $comments
)
));
|
The fix was to use this code instead:
 |  |
'table' => 'comments',
'values' => array(
'date' => $time,
'author' => $name,
'mail' => $mail,
'ip' => $_SERVER['REMOTE_ADDR'],
'comment' => $comments,
'reply' => $reply,
'post_id' => $id)
));
|
The same thing with adding news, the actual table fields are not in the same order as the insert script that adds the news, newer mySQL defaults do not like this!
half of my news imports was rejected because url and title in news table was string type and not text type. Very bad, use TEXT TYPE for url and title in news table to avoid all possible errors!!!!!!
Another strange thing I noticed was the index ID for news table starts with 1 and story table starts with index 0 during convert. Not good!
|
|
| Tue Jan 03, 2006 11:14 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|
 |
 |
 |
|