Total Format - Total Entertainment
 
 

Go Back   Total Format Forum > Computing Forums > Coding, Design & Graphics

Coding, Design & Graphics If you are programming a script, designing a web page, building your own graphics or anything related and need to discuss it, get help and tips or general advice, then you should post your thoughts to this section.

Reply
 
LinkBack Thread Tools Display Modes
Old 28-02-2009, 08:41   #1 (permalink)
Name, Title, Location weich1213
Basic Member

Your town.
Not Stated
Posts4
Karma weich1213 has not done anything good or bad yet.
Pu0
Default php mysql question

I'm having trouble inserting info from my php script to my database. Can anyone tell me why? Here's what my script looks like:

// write to database
mysql_query ('INSERT into members (first_name, last_name, email) VALUES ("chas", "nacio", "cwyke-smith@nacio.com")', $connectID)
or die ("Unable to insert record into database");


Thanks a lot
Toolsweich1213 is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 28-02-2009, 12:04   #2 (permalink)
Name, Title, Location Detomah
Owner&Designer

Total Format HQ
United Kingdom
AvatarDetomah's Avatar
Mood
Posts22,902
Karma Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.
Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.Detomah is a superior being.
Pu130,312.27
Critters
Blog
Blog Entries: 2
Awards
TF Activity Award - Silver TF Activity Award - Bronze TF Gaming Award - Silver TF Top Poster Bronze TF Top Poster - Silver TF Top Poster - Gold 
Total Awards: 6
Sunderland AFC Dog 2 Pie Treasure Single Red Rose England
Default

Try one of these, they come with tutorials, which is better than me just simply posting the answer to you direct, after all learning to do it yourself is better for your coding skills in the long term:

MySQL Tutorial - Insert
PHP MySQL Insert Into
Insert Data into a MySQL Database - PHP MySQL Tutorial

Although to be honest, the insert command is one of the most simple commands, so if you've not got to the point of doing those codes as second nature, i'd really suggest getting hold of a few php/mysql books from the library or something and sitting and reading them and doing all the little exercises in them.

Anyway, happy coding.
Detomah's Sig:
Donations - Help Total Format, by kindly donating your spare cash.
Site Map - See exactly what Total format has to offer during your stay.
TV Guide - check out what is on TV right here at Total Format.
Cartoons - Read the latest comics that Total Format has to offer.
Search | BBCodes | Smilies | FAQs | Forum Rules | Contact TF | Link To TF | Privacy Policy
Follow Total Format on Twitter HERE
ToolsDetomah is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 28-02-2009, 12:38   #3 (permalink)
Name, Title Puratech
The True Forsaken

United Kingdom
AvatarPuratech's Avatar
Mood
Posts5,948
Karma Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.
Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.
Pu1,062.54
Awards
TF Top Poster Bronze TF Top Poster - Silver 
Total Awards: 2
Heart Love Hearts Banana Grapes Dummy Cookie TV Chocolate Nut Slush Cake Donut Burger in a bun Big Beer Beer Umbrella Pie

Default

At a glance your statement looks fine, although im more than a little rusty with sql these days. I recall that the most common reason i got that problem, would be that there was a field in the table not being filled, or incorrect data type. Its also possible that your connection isnt right, as youve only shown a small part of the script - you need to get the connectID from the initial db connection you make.

Honestly without seeing more of the script, knowing your competence level with php (if youre new etc), and seeing your database table structure, its hard to diagnose any problem. Also knowing if you have direct/shell access would allow different approaches to checking things and being able to more closely examine the database - although you will probably have something like that php myadmin thingy if not.

Hope this is vaguely useful, and check out dets links above - with some previous experience those links and others helped me just dive headlong into it
Puratech's Sig:It's funny how life turns out,
The odds of faith in the face of doubt,
Camera One closes in,
The soundtrack starts,
The scene begins...


Quocunque Jeceris Stabit
ToolsPuratech is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-03-2009, 13:28   #4 (permalink)
Name, Title, Location Ixpah
Full Member

Nottingham, UK
England
AvatarIxpah's Avatar
Mood
Posts335
Karma Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.Ixpah is a competent TFer.
Pu8,097.70
Default

I don't really do php/mysql but standard SQL doesn't allow " (double quote) for string literals you need to use ' (single quotes) and to use ' inside a string literal itself you need to double it up, eg. ' becomes '' (2 single quotes). Or if php is like C/C++ escape it, e.g. \'
Ixpah's Sig:Check out my forums @ zints.co.uk or My Blog
ToolsIxpah is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links

Old 02-03-2009, 15:25   #5 (permalink)
Name, Title Puratech
The True Forsaken

United Kingdom
AvatarPuratech's Avatar
Mood
Posts5,948
Karma Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.
Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.Puratech is one of the elite.
Pu1,062.54
Awards
TF Top Poster Bronze TF Top Poster - Silver 
Total Awards: 2
Heart Love Hearts Banana Grapes Dummy Cookie TV Chocolate Nut Slush Cake Donut Burger in a bun Big Beer Beer Umbrella Pie

Default

Quote:
Originally Posted by Ixpah View Post
I don't really do php/mysql but standard SQL doesn't allow " (double quote) for string literals you need to use ' (single quotes) and to use ' inside a string literal itself you need to double it up, eg. ' becomes '' (2 single quotes). Or if php is like C/C++ escape it, e.g. \'
Hmm interesting, i presumed it wasnt fussy, php's syntax at least seems quite tolerant. What do you mean by standard sql btw, surely not the evil M$ variant?

Id always just done mysql_query("sql statement('string')");
Puratech's Sig:It's funny how life turns out,
The odds of faith in the face of doubt,
Camera One closes in,
The soundtrack starts,
The scene begins...


Quocunque Jeceris Stabit
ToolsPuratech is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 16-03-2009, 10:06   #6 (permalink)
Name, Title, Location weich1213
Basic Member

Your town.
Not Stated
Posts4
Karma weich1213 has not done anything good or bad yet.
Pu0
Question Problemo with the following code...

I'm trying to write to a flat file and the part that is giving me problems is this:





<?php


$success = writeToFile ($business_type, $maj_competitors, $products, $audience, $perception, $previous_stuff, $where_used, $image, $style, $dont_want, $colors, $time_spent, $words, $where_used, $other_comments);

if ($success) {
header ('Location: client_form_conf.php');

}

?>


Can anyone see any errors with it?
Toolsweich1213 is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 16-03-2009, 10:28   #7 (permalink)
Name, Title, Location weich1213
Basic Member

Your town.
Not Stated
Posts4
Karma weich1213 has not done anything good or bad yet.
Pu0
Default

Thanks for all the advise by the way
Toolsweich1213 is offline
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
mysql, php, question

Thread Tools
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Strange Question I Know Arcanine Health, Lifestyle, Hobbies and Sport 7 02-07-2008 23:00
Experts question BT's fibre trial Bandit UK & World News 0 12-06-2008 09:16
Vanguard: Dev Chat Log draganess Vanguard Sage of Heroes 0 14-03-2008 09:44
Secure Website Login Programming with PHP & MySQL Cintaria Coding, Design & Graphics 0 09-04-2007 22:56
World Of Pirates - FAQs Detomah World Of Pirates 0 29-11-2005 14:05

 
 
Archive - RSS Feeds - About Us - Privacy - Terms of Use - Site Map - Advertising - Link To TF - Contact Us - Top
Content Relevant URLs by vBSEO 3.2.0 RC5 Copyright ©2003 - 2000, Total Format. Forums powered by vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Limited.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385