-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] transferring excel data to mysql table
MadTechie replied to shane07's topic in PHP Coding Help
Oh i forgot MySQL & CSV try this LOAD DATA LOCAL INFILE '/importfile.csv' INTO TABLE test_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1, filed2, field3); -
[SOLVED] transferring excel data to mysql table
MadTechie replied to shane07's topic in PHP Coding Help
a CSV is a comma-separated values file format, Excel can be saved as a CSV file PHP & CSV, hope this helps -
changing css in the calender date(urgent)
MadTechie replied to localhost1's topic in PHP Coding Help
erm.. ok -
Finding the number of arrays after explosion?
MadTechie replied to woolyg's topic in PHP Coding Help
Erm.. what! you can not order by a number you need to order by a field... as for the count, the php count and mysql count are NOT the same.. i still have no idea what your trying to do! -
changing css in the calender date(urgent)
MadTechie replied to localhost1's topic in PHP Coding Help
the problem seams to be here <?php $query="select holiday_date from voyance_holidays where holiday_reservationtype='Telephone Reservation'"; //echo $query; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { //$d=$year."-".$month."-".$i; $string=$row['holiday_date']; $pieces=explode("-",$string); if($i==$pieces[2]) { $class_bg="cal_font_holiday"; } else { $class_bg="cal_font_current"; } }?> i'll explain, as you loop throught the records, $class_bg will only be set to the LAST records, as its a loop i assume that the request find a set.. so what you need to do, is change it to something like to something like this <?php $query="select holiday_date from voyance_holidays where holiday_reservationtype='Telephone Reservation'"; //echo $query; $result=mysql_query($query); while($row=mysql_fetch_array($result)) { //$d=$year."-".$month."-".$i; $string=$row['holiday_date']; $pieces=explode("-",$string); if($i==$pieces[2]) { $class_bg[$i]="cal_font_holiday"; } else { $class_bg[$i]="cal_font_current"; } }?> then change the TWO uses below from class=".$class_bg." to class=".$class_bg[$i]." [updated - to make sence!] EDIT: Please Note i only skimmed the code and it does need cleaning up, also "urgent" work should be posted in the freelance section with an offer , free help you have to wait for -
Finding the number of arrays after explosion?
MadTechie replied to woolyg's topic in PHP Coding Help
i'm not 100% sure what your asking but i assume you want this <?php $text = 'hi, there, everyone, ..., .., ......'; $arr = explode(", ",$text) $Total = count($arr); $SQL = "SELECT * FROM table ORDER BY $Total DESC LIMIT 1"; ?> BUT this will probably fail.., as $Total should be a field name.. not a number! i have no idea what your trying to do please explain what you want the end result to be. -
humm.. you could probably get away with this! <?php $html = '<head> <body onload="test();"> <b>testing</b> </body> '; $html= preg_replace('/<[^>]*>/i', '', $html); $html= preg_replace('/(\n){2,}/i', '<br>', $html);//updated //line removed echo $html; ?>
-
Try this <?php $html = '<head> <body onload="test();"> <b>testing</b> </body> '; $html= preg_replace('/<[^>]*>/i', '', $html); $html= preg_replace('/(\r\n){2,}/i', '\r\n', $html);//ADDED echo nl2br($html); ?>
-
[SOLVED] Using More Than One Water Mark
MadTechie replied to phpQuestioner's topic in PHP Coding Help
the example above basically create one image out of two, so you could use it to create a (two in one watermark, then use that (two in one) on another image to make a three in one image -
Sorry still not 100% sure what your asking! you asking about a database (if so what database) or a form! for a mysql database you could use something like this! <?php $conn = mysql_connect("localhost", "mysql_user", "mysql_password"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("mydbname")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $sql = "SELECT * FROM thetable"; //or //$sql = "SELECT * FROM thetable WHERE ID = 1"; //or //$sql = "SELECT * FROM thetable WHERE color = 'red' "; //note the single quotes $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; exit; } while ($row = mysql_fetch_assoc($result)) { echo $row["id"]; echo "="; echo $row["color"]; echo "<br>"; } mysql_free_result($result); ?>
-
you could remove them ie <?php $html = '<head> <body onload="test();"> <b>testing</b> </body>'; $html= preg_replace('/<[^>]*>/i', '', $html); echo $html; echo "<br>View Source, to check tags have been removed"; ?>
-
[SOLVED] Using More Than One Water Mark
MadTechie replied to phpQuestioner's topic in PHP Coding Help
Heres a basic watermarker.. just use imagecopy to create 2 watermarks in one or run this twice.. <?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('watermark.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg($_GET['src']); imagealphablending($image, true); $size = getimagesize($_GET['src']); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> any problem just ask -
non-specific question, soooo try echo $_POST['color']; or echo $_GET['color'];
-
so if i put that in a file and ran it.. it would do something!!!
-
Working with a bar code scanner, question.
MadTechie replied to NerdConcepts's topic in PHP Coding Help
With a scanner system i wrote awhile ago, the scanner stored the scanned data, i then downloaded this onto my pc as a text file, now i used a Desktop app i wrote with this but surely you could do the same with php just upload it first?? -
[SOLVED] Variable substitution (i.e. <?=$Scompany?>)
MadTechie replied to cdikland's topic in PHP Coding Help
personally i hate short tags and would normally use this ....' value='<?php echo $Scompany; ?>'></td>.... check short tags is enables in the php.ini file -
Echo d.shankar, <--is correct @aniket_dj, please read the pinned topic called headers or try opening the download script via a new window ie <a href="download.php" target="_blank">download</a>
-
by the looks of things your missing a part of it... maybe in another file.. does that work in your project as is ?
-
Your need to use a SMS service.. the details will be on their site! and yes your need to pay for it
-
Extra Info.. your need to change the prov later so.. via PMA, select the prov field and click edit (change), Now in the length/value will appear as 'small','medium','large' change to what you need ie 'US','UK','Europe','Blar','etc' Hope all goes well, if you have more problems include a link to the tutorial so we can see what "should" happen
-
POST the EXACT code i have below in PMA's SQL section it should work.. i'll note again the ENUM('small', 'medium', 'large') was made up.. this will need to be changed to suite ie ENUM('UK', 'US', 'Europe') or whatever its used for.. the reason yours failed it because you tried to add the list in to the comments..!
-
The ENUM is wrong try this CREATE TABLE `members` ( `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `username` VARCHAR( 15 ) NOT NULL , `encryptpass` VARCHAR( 255 ) NOT NULL , `password` VARCHAR( 15 ) NOT NULL , `name` VARCHAR( 255 ) NOT NULL , `prov` ENUM('small', 'medium', 'large') NOT NULL , `style` TINYTEXT NOT NULL , `hist` TEXT NOT NULL , `open` TEXT NOT NULL , `webs` VARCHAR( 255 ) NOT NULL DEFAULT 'http://', `email` VARCHAR( 255 ) NOT NULL , `photo` VARCHAR( 255 ) NOT NULL DEFAULT 'nopic.jpg', `signupdate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE = MYISAM Note: update the prov (ENUM) to the correct data i also updated the `signupdate` & the ID
-
Working with a bar code scanner, question.
MadTechie replied to NerdConcepts's topic in PHP Coding Help
it all depends on the barcode.. ie an EAN13 is 12 to 13 numbers (last one being the checksum) your probably need some javascript that validates the barcode and then when that matches checks the database, I think your going to need to do some javascript for the ajax style command to call the php code.. -
maybe update <?php /* includes */ if (isset($_SESSION['playerid'])) { include '/home/ace/public_html/conflictingforces/functions.php'; include '/home/ace/public_html/conflictingforces/variables.php'; player_session(); } /**********************/ // Player Select Variables // /**********************/ // Turns (cronjob related selects) $player_ammo = player_table("ammo"); $player_bank = player_table("bank"); $player_money = player_table("money"); $player_currenthealth = player_table("currenthealth"); $player_maxhealth = player_table("maxhealth"); $player_currentpower = player_table("currentpower"); $player_maxpower = player_table("maxpower"); ?> <div id = "nav"> Navigational Panel<br> <hr> <?php $date=date(U); // format date for calculation in seconds //print ("$date"); //if you want to see the date format now $hourdiff = "16"; //change the server time plus sixteen hours $timeadjust = ($hourdiff * 60 * 60); //this is how to calc it $adjtime = date("M j, H:i", $date + $timeadjust); //format display print $adjtime; //print the adjusted time ?> <hr> <br> <?php // Use $HTTP_SESSION_VARS with PHP 4.0.6 or less if (!isset($_SESSION['playerid'])) { ?> <a href="index.php?page=home">Home</a><br> <a href="index.php?page=progress">Progress</a><br> <a href="index.php?page=encyclopedia">Encyclopedia</a><br> <a href="index.php?page=support">Support</a><br> <a href="http://www.crikeygames.com.au/forum/">Forum</a><br><br> <?php // Use $HTTP_SESSION_VARS with PHP 4.0.6 or less } if (isset($_SESSION['playerid'])) { ?> <a href="index.php?page=base">Base</a><br> <a href="index.php?page=inventory">Inventory</a><br> <a href="index.php?page=encyclopedia">Encyclopedia</a><br> <a href="index.php?page=support">Support</a><br> <a href="index.php?page=logout">Logout</a><br><br> <hr> Ammo: <?php echo $player_ammo; ?><br> Money: <?php echo $player_money; ?><br> Bank: <?php echo $player_bank; ?><br> Health: <?php echo $player_currenthealth; ?>/<?php echo $player_maxhealth; ?><br> Power: <?php echo $player_currentpower; ?>/<?php echo $player_maxpower; ?> <hr> <?php } ?> </div>
-
Hummm, the die should of stopped the inf. loop i assume you commented out the header as well! also change function player_table($select) { if (!isset($_SESSION['playerid'])) { // Destroy the session session_destroy(); // Automatically redirect to the homepage header("Location: index.php?page=home"); } to function player_table($select) { if (!isset($_SESSION['playerid'])) { // Destroy the session session_destroy(); // Automatically redirect to the homepage //header("Location: index.php?page=home"); die("Failed #2: <a href='index.php?page=home'>Home</a>"); } i'm also a little confused over the logout scipt.. as you say "index.php?page=home" redirects to logout yet the script also redirects their!