-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] INSERT in MySQL problem... My code is not working?
MadTechie replied to bri0987's topic in PHP Coding Help
used backtick as i was confused why you was getting a Field error.. but the key was GetCartId() is a string thus must be quoted the others are int's so no quotes were needed TimeStamp fix option #1 (via PHP code) $query = "INSERT INTO tblshoppingcart (`Cookie_ID`, `Product_ID`, `Component_ID`, `qty`, `Cart_Date`) VALUES ('" . GetCartId() . "', " . intval($ProductID) . ", " . intval($component) . ", " . intval($qty) . ", NOW())"; EDIT: option #2 (auto via MySQL) from phpMyAdmin run SQL ALTER TABLE `tblshoppingcart` CHANGE `Cart_Date` `Cart_Date` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP -
[SOLVED] INSERT in MySQL problem... My code is not working?
MadTechie replied to bri0987's topic in PHP Coding Help
should but Unknown column 'f765354f720f0d73ac26194fe47fb016' in 'field list'... value list i'll expect but field! -
[SOLVED] INSERT in MySQL problem... My code is not working?
MadTechie replied to bri0987's topic in PHP Coding Help
you should of got a error message like this can you post the blar blar part also did you try the last code set i posted.. i know with every man, woman & dog posting it can get confusing.. -
[SOLVED] INSERT in MySQL problem... My code is not working?
MadTechie replied to bri0987's topic in PHP Coding Help
Okay.. try this update.. is it possible to the error.. the part thats starts query='INSERT INTO ...etc..' as the field are all static its kinda a strange message.. <?php if (isset($_POST['AddToCart'])) { $qty = "1"; foreach ($_POST["Component_ID"] as $type => $component) { // mysql_select_db($database_DM_database, $DM_database) or die(mysql_error()); $query = "INSERT INTO tblshoppingcart (`Cookie_ID`, `Product_ID`, `Component_ID`, `qty`) VALUES ('" . GetCartId() . "', " . intval($ProductID) . ", " . intval($component) . ", " . intval($qty) . ")"; mysql_query($query) or die("query='$query '<br>".mysql_error()); } //header("Location: cart.php"); } else { $ihateyou = "I HATE YOU"; } ?> -
[SOLVED] INSERT in MySQL problem... My code is not working?
MadTechie replied to bri0987's topic in PHP Coding Help
first things first.. lets add some error capturing.. <?php if (isset($_POST['AddToCart'])) { $qty = "1"; foreach ($_POST["Component_ID"] as $type => $component) { // mysql_select_db($database_DM_database, $DM_database) or die(mysql_error()); $query = "INSERT INTO tblshoppingcart (Cookie_ID, Product_ID, Component_ID, qty) VALUES (" . GetCartId() . ", " . intval($ProductID) . ", " . intval($component) . ", " . intval($qty) . ")"; mysql_query($query) or die("query='$query '<br>".mysql_error()); } //header("Location: cart.php"); } else { $ihateyou = "I HATE YOU"; } ?> -
CR = \r LF = \n i just defind CRLF as "\r\n" the reason i double it, is mainly because it seam to work better on more mail servers.. an octet is the name of the group of 8 bits that make up 1 byte.. from the Octal number base.. i don't think i have even said that outside of a computer science class! anyways its defind from "octet-stream" but you could use multipart/related.. its all down the file type your using.. "octet-stream" seams to work on 99% of them
-
allow_url_fopen is a secuirty risk (when used incorrectly) only differents it can cause major problems if not filtered, example your find you probably won't have allow_url_fopen CURL CRON get one with register_globals turned OFF... magic quotes are a pain.. i think its better to filter myown code than have magicquotes mess it up for me..
-
[SOLVED] Random selection from pre-defined set
MadTechie replied to Michan's topic in PHP Coding Help
Side Note: As of PHP 4.2.0, there is no need to seed the random number generator with srand() or mt_srand() as this is now done automatically. -
Okay.. Multiple extra headers should be separated with a CRLF (\r\n). Encoding should be base64 if your attacking a file i encode it ie <?php $fp = fopen($file,"rb"); $fcontent = fread($fp ,filesize($file)); fclose($fp); $content = chunk_split(base64_encode($fcontent)); ?> as for the OCTET.. well the data may not be text only, so octet works better.. I think i covered them all!! let me know what doesn't make sense
-
[SOLVED] Random selection from pre-defined set
MadTechie replied to Michan's topic in PHP Coding Help
FYI: you could also do this (if you want to use an array) <?php $mypic = array("1","3","7"); $rand = array_rand($mypic); echo $mypic[$rand]; ?> EDIT: also rand does NOT Require a min & max, they are optional but in phpQuestioner, code it should be rand(0, count($mypicks)); -
$body .= "Content-Type:".OCTET."; name=\"$file\"".CRLF; $body .= "Content-Transfer-Encoding: base64".CRLF.CRLF; $body .= "Content-Disposition: attachment; filename=\"$file\"".CRLF.CRLF;
-
like phpQuestioner i can not recommend any.. but this may help http://www.0php.com/free_PHP_hosting.php Byet Host seams to be the best!
-
have you checked the XML file ? the routine that creates it ? could be charset.. without more info. its going to be guesses
-
yes it would cause a spike, best bet would be create a queue, and then have a cron to run convert. also detect if its already running..
-
[SOLVED] Interactive Site - Limiting game plays per day?
MadTechie replied to Nikker's topic in PHP Coding Help
Second works for me, due the limited data, thats should NOT be too stressfull on the system.. i would probably have a table with ID, UserID, GameID & DateStamp then you can check like SELECT count(*) as TimesPlayed WHERE UserID=$uID AND GameID=$gID AND DateStamp=CURDATE(); .. at the end on the week/month you could just use TRUNCATE TABLE, to clean it up (for a quickness) EDIT: missed the NOT.. LOL -
read last post in this thread http://www.phpfreaks.com/forums/index.php/topic,163402.0.html
-
another post (same idea) http://www.phpfreaks.com/forums/index.php/topic,161173.0.html EDIT: just did a search for ffmepg
-
[SOLVED] Checkbox mail List / Round 2 (e-mail help)
MadTechie replied to hinchcliffe's topic in PHP Coding Help
whats the "problem" ? -
use System() or exec() and readup on ffmpeg command lines
-
it would probably be better to move this to third party also do you have the latest version?
-
where did you get the class from ? i assume theirs also a "setCost()" but without more details its going to be hit & miss
-
Well your not using the class correctly.. the way your using it your $totalCost would have to be worked out like this $totalCost = $item + $item2;
-
you could try changing the null's to 0 ~OR~ <?=!is_null($item->getCost()) ? $item->getName() : ''?> <?=!is_null($item->getCost()) ? '$' . $item->getCost() : ''?> <?=!is_null($item2->getCost()) ? $item2->getName() : ''? <?=!is_null($item2->getCost()) ? '$' . $item2->getCost() :''?>
-
[SOLVED] convert insert statement to update statement
MadTechie replied to trpplayer79's topic in PHP Coding Help
Maybe you should read this MySQL Insert look for "ON DUPLICATE KEY UPDATE" it may help.. you could use a RegEx to convert Insert to Update, Hope this helps -
telling us the "problem" may be an idea!