-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
works a treat on forms
-
OK first thats a kinda weird header of a JPEG!.. in anycase change // print out the correct header to the browser header("Content-type:image/jpeg"); // display the image imagegif ($img); to // print out the correct header to the browser //header("Content-type:image/jpeg"); // display the image imagegif ($img,"temp.gif"); should create a file temp.gif
-
erm.. in another file that uses $sql-> your find a line like include "something"; $sql = new something; best bet is to find that.. and copy it
-
Sorry you shouldn't double post.. thats code is only the basic start of the OOP login system.. Techie out
-
Ermm both post would do the same thing!! i assumes you created the image resource and wanted to put it into a file for emailing! the i commented out the //$imgname = "image.gif"; //$img = imagecreatefromgif($imgname); was to show the creation of the image resource! whats is $img ? exactly how did you generate it
-
you need to declare the $sql ie include "myclass.php" $sql = new myclass();
-
this should be in the OOP section, i don't see where you are checking the usernames or redirecting ?!
-
try this (untested) <?php //**** //you have this part but for referance i included it //$imgname = "image.gif"; //$img = imagecreatefromgif($imgname); //**** // NOTE: that $img is the image resource $filename = 'temp.gif'; if (is_writable($filename)) { if (!$handle = fopen($filename, 'w+')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, imagejpeg($img)) === FALSE) { echo "Cannot write to file ($filename)"; exit; } fclose($handle); } else { echo "The file $filename is not writable"; } ?>
-
try mysql_select_db('czartga_login') or die('Error, cannot select mysql database'); $query="update users set num_clicks=(num_clicks+1) "; $result=mysql_query($query);
-
what do you have so far?
-
well this is my update i changed a few thing so it makes more sense to me but i don't know thw databse setup etc, the logic is the main thing <?php // From DB // CSCart DB Info $hostF = "localhost"; $userF = "user"; $passF = "pass"; $dbnameF = "cscart0"; //To DB // OSC DB Info $hostT = "192.168.6.2"; $userT = "user"; $passt = "pass"; $dbnameT = "shop0"; // Connect to cscart $handleFrom = mysql_connect($hostF, $userF, $passF); // Connect to osc $handleTo = mysql_connect($hostT, $userT, $passT); // Select the cscart database mysql_select_db($dbnameF,$handleFrom) or die("Couldn't connect to DB"); // Select the osc database mysql_select_db($dbnameT,$handleTo) or die("Couldn't connect to DB"); // Query OSC $SqlFrom = "SELECT products_model, products_price FROM products "; // OSC Results $resultFrom = mysql_query($SqlFrom, $handleF); if (!$resultFrom) { die('<p>Error performing query: ' . mysql_error() . '</p>'); } while ( $FromRow = mysql_fetch_array($resultFrom) ) { $FromID = $FromRow['product_id']; $FromPart = $FromRow['products_model']; $FromPrice = $FromRow['products_price']; $SqlTo = "SELECT products_model, products_price FROM products WHERE product_id = '$FromID' AND product_code = '$FromPart'"; $resultTo = mysql_query($SqlTo,$handleT); $ToRow = mysql_fetch_array($resultTo); $ToPart = $ToRow['products_model']; $ToPrice = $ToRow['products_price']; echo "<p>Part $FromPart is being updated from $FromPrice to $ToPrice" . "<br />"; $SqlUpdate = "UPDATE cscart_product_prices SET price='$ToPrice' WHERE product_id = '$FromID' AND product_code = '$FromPart'" $result = mysql_query($SqlUpdate, $handlecscart) or die(mysql_error()); } ?>
-
what php code do you have so far ?
-
probably from an included file.. not in that code supplied unless global register is on
-
add a field and just update it by 1 per view! we will need to see some code really
-
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
ok, i took the time to test this one $n=0; $prefixkey = "subscriptionevents_subscriptionfile_"; $surfixkey= "_filename"; $NewKey= $prefixkey.($n+1).$surfixkey; $OldKey= $prefixkey.($n).$surfixkey; while (array_key_exists($NewKey,$marray)) { echo $marray[$OldKey]; echo " => "; echo $marray[$NewKey]; echo "<br>"; $n++; $OldKey= $prefixkey.($n).$surfixkey; $NewKey= $prefixkey.($n+1).$surfixkey; } -
full update <?php // CSCart DB Info $hostcs = "localhost"; $usercs = "user"; $passcs = "pass"; $dbnamecs = "cscart0"; // OSC DB Info $hostosc = "192.168.6.2"; $userosc = "user"; $passosc = "pass"; $dbnameosc = "shop0"; // Connect to cscart $handlecscart = mysql_connect($hostcs, $usercs, $passcs); // Connect to osc $handleosc = mysql_connect($hostosc, $userosc, $passosc); // Select the cscart database mysql_select_db($dbnamecs,$handlecscart) or die("Couldn't connect to DB"); // Select the osc database mysql_select_db($dbnameosc,$handleosc) or die("Couldn't connect to DB"); // Query OSC $selectosc = "SELECT products_model, products_price FROM products "; if (!$selectosc) { die('<p>Error performing query: ' . mysql_error() . '</p>'); } // OSC Results $resultosc = mysql_query($selectosc,$handleosc); if (!$resultosc) { die('<p>Error performing query: ' . mysql_error() . '</p>'); } //*******ONLY LOOP ONE //while ( $rowcs = mysql_fetch_array($resultcs) AND $rowosc = mysql_fetch_array($resultosc) ) while ( $rowosc = mysql_fetch_array($resultosc) ) { $oscpart = $rowosc['product_code'] ; $oscprice = $rowosc['price']; $oscPID = $rowosc['product_id'] ; //Find the New Product price etc $selectosc = "SELECT products_model, products_price FROM products WHERE products_id = $oscPID"; $resultcs = mysql_query($selectcs,$handlecscart); $rowcs = mysql_fetch_array($resultcs); $cspart = $rowcs['products_model']; $csprice = $rowcs['products_price']; echo "<p>Part $cspart is being updated to $oscprice" . "<br />"; $result = mysql_query("UPDATE cscart_product_prices SET price='$csprice' WHERE cscart_products.product_id = $oscPID",$handlecscart) or die(mysql_error()); } ?>
-
LOL, correct fix i'll settle for clicking on the topic solved (bottom left)
-
after a quick review change while ( $rowcs = mysql_fetch_array($resultcs) ) to while ( $rowcs = mysql_fetch_array($resultosc) )
-
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
remember to click topic solved if all is working -
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
the $therray has to be the name of your array/object -
OK your running PHP4 not PHP5 try this <?php $file = "shadow%00.txt"; if (file_exists($file)) { $file_content=file_get_contents($file); }else{ $cf = fopen($file, "w") or die("Error: file does not exist, and it can not be created.<BR>Please check permissions in the directory or create a file with coresponding name."); fputs($cf, ","); fclose($cf); } $tmp = explode(",", $file_content); $tmp = array_flip ( $tmp ); $tmp = array_flip ( $tmp ); $tmp = implode(",", $tmp); //PHP5 only //file_put_contents ( "New".$file, $tmp ); //PHP 4 Safe if (!$handle = fopen("New".$file, 'a+')) { echo "Cannot open file New".$file; exit; } if (fwrite($handle, $tmp) === FALSE) { echo "Cannot write to file New".$file; exit; } fclose($handle); ?>
-
$entry_line = "Username: $username | ID: {$_SERVER['REQUEST_URI']} \n"; I not L note $_SERVER['QUERY_STRING'] $entry_line = "Username: $username | ID: {$_SERVER['QUERY_STRING']} \n"; is the correct one to use
-
[SOLVED] looping thru array like for loop
MadTechie replied to smilesmita's topic in PHP Coding Help
updated $n=0; $prefixkey = "subscriptionevents_subscriptionfile_"; $surfixkey= "_filename"; $NewKey= $prefixkey.($n+1).$surfixkey; while ( array_key_exists($NewKey, $therray) ) { echo $therray[($n).$key]; echo $therray[($n+1).$key]; $n++ $NewKey= $prefixkey.($n+1).$surfixkey; }