-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] Handling Images .... OS file or MySQL storage
MadTechie replied to PhpTim's topic in PHP Coding Help
what about debugging.. and filetypes,sizes etc.. the FILEsystem was designed for this very reason, use the correct tool for the correct job.. putting all your eggs in one basket maybe easier to manage, but is it the right way to manage ??? OK.. i'm done with the battle (its been fun) .. truly theirs a lot of things to think about your need to weight all the pros and cons.. waits for dbo's last battle cry lol -
[SOLVED] Checking if a variable is an integer?
MadTechie replied to Warptweet's topic in PHP Coding Help
$X =$_GET['width']; $isint = (bool)(($X == ((int)$X)) && is_numeric($X)); echo ($isint)?"":"invalid width"; EDIT: leaves it in dbo capable hand -
first the file type is always set to PNG header("Content-Type: image/png" also i don't think echo in binary safe, maybe use convert_uuencode/convert_uudecode
-
[SOLVED] Handling Images .... OS file or MySQL storage
MadTechie replied to PhpTim's topic in PHP Coding Help
But to access the images is quicker when using a file system.. and less stress on the database.. thus making it faster than the DBFS.. why put all your eggs in one basket share the work load.. if you create users folder and have the files stored in their and have a cron to dump the mysql to a folder its just one backup this post could last for days LOL -
[SOLVED] Checking if a variable is an integer?
MadTechie replied to Warptweet's topic in PHP Coding Help
try $X = "test"; $isint = (bool)(($X == ((int)$X)) && is_numeric($X)); var_dump($isint); echo "$X"; -
[SOLVED] Checking if a variable is an integer?
MadTechie replied to Warptweet's topic in PHP Coding Help
why not keep it simple IE $X = "7.4"; $isint = (bool)($X == ((int)$X)); var_dump($isint); -
both are good in their own way, just choose the right tool for the right job.
-
Yeah, remembed that after i hit post LOL..
-
[SOLVED] Handling Images .... OS file or MySQL storage
MadTechie replied to PhpTim's topic in PHP Coding Help
Dang.... i scored and own goal on that one, LOL -
try $string= nl2br($string); EDIT:
-
[SOLVED] Handling Images .... OS file or MySQL storage
MadTechie replied to PhpTim's topic in PHP Coding Help
WooHoo another FS vs. DB war.. I'm on the ......erm...... FS (FileSystem) side, upload a folder thats outside the public_html folder and read it in via a php script, of course this script can check the database first including the filename/path. but again personal preferance.. had a few sleepless nights with DBFS (DataBase FileSystem) EDIT: one good/bad thing about DBFS is you can do one backup of the database and have all the sites details include photo etc and the static stuff like background and code doesn't change so only need to back that up when you upgrade.. bad news the DB will be much larger -
i think you should try it.. start with $_SESSION['test'] = "hello"; then $_SESSION['test']['test2'] = "hello"; remember print_r($_SESSION); helps
-
1. its not the speed of light, that FDDI and even then the data needs to be translated and relayed.. 2. the IP doesn't need to be looked up in a DNS thus its faster. Seriously.. who runs a server using a dynamic ip? :-) I know I used to run dev servers from home using a dynamic ip, however, I would never run any production server without a static ip. Erm.. my last company did before i join LMAO.. yeah i know but its worth saying, just incase someone is trying to cut costs
-
Very true thope but only if the IP is static, if its dynamic then use the hostname (so it can be resolved by the DNS, of course this is a little slower)
-
All i know about your VB App is it sends data, so theirs no way i can suggest anything about replacing that as it depends on the data and where that data is comming from in the first place, yes the problem could be with the URLs being either to long or being incorrectly crafted..
-
[SOLVED] Mass SQL import (singles are ok?)
MadTechie replied to MadTechie's topic in PHP Coding Help
Woohoo Thanx all, mysqli seams to of done it, just need to build it into my main code now heres my working sample code (incase someone need to do the same) <?php test(); function test() { require_once "../conf.inc.php"; $mysqli = new mysqli(DBS_HOST, DBS_USER, DBS_PASS, DBS_DB); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } echo "sending...<br />"; /* execute multiple statements */ $status = mysqli_multi_query($mysqli," INSERT INTO `PB2` (`LFT`) VALUES ('test1' ); INSERT INTO `PB2` (`LFT`) VALUES ('test2' ); INSERT INTO `PB2` (`LFT`) VALUES ('test3' ); ") or die(mysqli_error()); echo "sent...<br />status:"; var_dump($status); echo "<br />close connection<br />"; /* close connection */ $mysqli->close(); } oh an you can use the insert like Barand says but for my project i couldn't without a few too many changes. -
[SOLVED] Mass SQL import (singles are ok?)
MadTechie replied to MadTechie's topic in PHP Coding Help
Only using the PMA for testing and reviewing the data, basically i couldn't see a problem so i used PMA to "attempt" the import so i see the problem more clearly.. yet their was none.. unless PMA corrected it for me! -
it works fine.. view sourse
-
OK, bascially i have some code that imports alot of data into the MySQL database, Now this is fine when i use the INSERT INTO one record at a time.. but if i do 2 records ie INSERT INTO `PB2` (`field1`,`field2`) VALUES ('111' ,'222'); INSERT INTO `PB2` (`field1`,`field2`, `field3`) VALUES ('333' ,'444', '555'); in which case i get the error on line 1 so it would seam the ; is causing the problem.. but even when i do them one by one it has the ;, AND if i copy the SQL statement that is echoed with the error and run it in PMA (phpMyAdmin) it runs without error!.. the only thing i can think of is a limit set by the host.. ? any ideas? i truely hope its something stupid and not the host..
-
change mysql_query("update `users` SET clan='$name' WHERE ID=$user->ID"); to mysql_query("update `users` SET clan='$name' WHERE ID=$user->ID") or die(mysql_error()); it will tell you the errors!
-
OK first off, this code is fine (well kinda) <?php } else { $line1=htmlentities(stripslashes($line1), ENT_QUOTES); $line2=htmlentities(stripslashes($line2), ENT_QUOTES); mail( "me@myemail.com", "Email Subject", "$title $name\n$address\n$city, $state, $zip\nPhone Number: $phone\nCell Phone: $cell\n$email\n\nStar Size: $star\n\nEngraving will read...\n\nhtmlentities(stripslashes($line1), ENT_QUOTES);\n$line2", "From: $name <$email>" ); } if ($star == "4 inch $150"){ ?> basically the problem your facing is in the email, the reason your getting the > etc etc, is because of the email format.. (being plan text) to resolve this you need to tell the email client that the email contains html not just plan text.. to do this.. change the (in the mail function) "From: $name <$email>" "From:$name <$email>\r\nReply-to: $email\r\nContent-type: text/html; charset=us-ascii"
-
[SOLVED] Forming a SQL statement from multiple checkboxes
MadTechie replied to gamefreak13's topic in PHP Coding Help
erm.. first thats not valid for a form, try <input name="checkbox4" type="checkbox" value="Checkbox 4"/>Checkbox 4 -
check the upload works by storeing the file in a temp dir, then attach from their, after that unlink the file
-
personally i found phpmailer works really well.. if not then setup the mime etc, see lemmin post