-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] Variable running when it shouldn't
MadTechie replied to goocharlton's topic in PHP Coding Help
try this function GetNews() { include("news_items.php"); $str = ''; foreach ($news as $value){ $str .= "<p>"; $str .= "<b>" .$value['date']. "</b><br>"; $str .= $value['content']; $str .=" <p>"; } return $str; } -
[SOLVED] Variable running when it shouldn't
MadTechie replied to goocharlton's topic in PHP Coding Help
can you post line 6-8 of news-and-press2.php -
[SOLVED] how to appear mysql data into a form text and element?
MadTechie replied to zgkhoo's topic in PHP Coding Help
Personally i like to know where the data is from $_REQUEST is too much like register_globals which i hate.. -
[SOLVED] Variable running when it shouldn't
MadTechie replied to goocharlton's topic in PHP Coding Help
change to <?php function GetNews() { include("news_items.php"); $str = ''; foreach ($news as $value) { str .= "<p>"; str .= "<b>" .$value['date']. "</b><br>"; str .= $value['content']; str .=" <p>"; } return $str; } ?> Note $value[date] to $value['date'] $value[content] to $value['content'] -
[SOLVED] how to appear mysql data into a form text and element?
MadTechie replied to zgkhoo's topic in PHP Coding Help
MySQL Manual link if(isset($_REQUEST['button'])){ } will be fine (personally i'll use $_POST) $TheField = "ten"; $field2 = 1; //SQL statement UPDATE table SET field = '$TheField' WHERE field2 = $field2; -
[SOLVED] New To PHP - please help with image upload!
MadTechie replied to g3mma111's topic in PHP Coding Help
just change $filename = "profilepicthumb/". $_FILES['uploadfile']['name']; to the new path & name from what i can see thats what is it doing! ie $filename = "profilepicthumb/sam.jpg"; -
<?php $query2 = "INSERT INTO games (gName, gDescription, gSwfFile, gInCategory, gVisible, gOrder, gWidth, gHeight, description2, des2, sponsor_name, sponsor_link, filetype, gThumb, gId, gPlays, playstoday) values ('".addslashes($title)."', '".addslashes($descr)."', '".addslashes($md5)."', '1', '1', '0', '300', '350', '', '', '', '', '1', '$md5.png', '999999', '', '')"; mysql_query($query2) or die(mysql_error().'<br /><br />Query:'.$query2); ?> last one ('\350' to '350') then post the full thing..
-
change to <?php $query2 = mysql_query("INSERT INTO games (gName, gDescription, gSwfFile, gInCategory, gVisible, gOrder, gWidth, gHeight, description2, des2, sponsor_name, sponsor_link, filetype, gThumb, gId, gPlays, playstoday) values ('".addslashes($title)."', '".addslashes($descr)."', '".addslashes($md5)."', '1', '1', '0', '300', '350\', '', '', '', '', '1', '$md5.png', '999999', '', '')"); mysql_query($query2) or die(mysql_error().'<br /><br />Query:'.$query2); ?>
-
well this works for me <?php $link = mysql_connect("localhost", "####", "###"); mysql_select_db("###", $link); $query = "select count(ID) from TestTable where Weight ='100g'"; $result = mysql_query($query) or die(mysql_error(). " with query ". $query); $dupe = mysql_result($result, 0); print_r($dupe); if(!empty($dupe)) { // continue; }
-
can you post line 286 of /home/arcadeh/public_html/images.php
-
change $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n"; to $email_message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n"; Note the removed dot "$email_message = " as this is the first time your setting it
-
change $dupe = mysql_result($result , 0); to $dupe = mysql_result($result , $link);
-
[SOLVED] Accessing dynamically created HTML forms
MadTechie replied to amjohnno's topic in PHP Coding Help
use $_SERVER['REQUEST_URI'] // or $_SERVER['QUERY_STRING'] // or foreach($_POST as $K => $V) { echo $K." => ".$V; } -
can you echo $SQL; can see what you get also mysql_select_db("arcadeh_gsdb", $link) or die(mysql_error());
-
the only way i can think if you doing this something like this <?php $url="www.google.com"; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_FAILONERROR,true); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); $data = curl_exec($ch); //here $data variable contains the source of google.com preg_match_all('/.*action\s?=(?:\'|"|\s)?([^\'"\s\>]*)(?:\'|"|\s)?.*?name=(?:\'|"|\s)?([^\'"\s\>]*)(?:\'|"|\s)?/s', $data, $result, PREG_PATTERN_ORDER); $forms = $result[1]; $values = $result[2]; echo "<pre>"; print_r($forms); print_r($values); echo "or<br />"; $newarray = array(); foreach($forms as $K => $V) { $newarray[] = "$V & {$values[$K]}"; } print_r($newarray); ?> have a go see if it works
-
news_items.php funtion GetSomeData() { $tmp = ""; foreach ($news as $value) { $tmp .= "<p>"; $tmp .= "<b>" .$value[date]. "</b><br>"; $tmp .= $value[content]; $tmp .= "<p>"; } return $tmp } other php script include("news_items.php"); $variable = GetSomeData();
-
try a search for php & sql tutorial..
-
yep.. not sure what you want this for but.. <?php $url="www.google.com"; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_FAILONERROR,true); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); $data = curl_exec($ch); //here $data variable contains the source of google.com preg_match_all('/(?<=\<form )action="([\S]+)".*?name=(\w+)/s', $data, $result, PREG_PATTERN_ORDER); $forms = $result[1]; $values = $result[2]; echo "<pre>"; print_r($forms); print_r($values); echo "or<br />"; $newarray = array(); foreach($forms as $K => $V) { $newarray[] = "$V & {$values[$K]}"; } print_r($newarray); ?>
-
you need to change this if($value != "image/jpeg" AND $value != "image/pjpeg" AND $value != "") { to if($value != "text/html" AND $value != "application/pdf" AND $value != "") { oh and the message exit('Sorry , current format is <b>'.($value).'</b> ,only html or pdf are allowed') ; EDIT: also please don't PM me the post... unless theirs private data and you trust me and i request it
-
same issule! i assume the first file was register3.php
-
see example ( have done ic & full name ) you just need the same with gender to accnumber <?php session_start(); if(isset($_POST["ic"])) { $_SESSION["ic"] = $_POST["ic"]; } if(isset($_POST["fullname"])) { $_SESSION["fullname"] = $_POST["fullname"]; } $_SESSION["gender"] = $_POST["gender"]; $_SESSION["address"] = $_POST["address"]; $_SESSION["postcode"] = $_POST["postcode"]; $_SESSION["city"] = $_POST["city"]; $_SESSION["state"] = $_POST["state"]; $_SESSION["phonenumber"] = $_POST["phonenumber"]; $_SESSION["hpnumber"] = $_POST["hpnumber"]; $_SESSION["banktype"] = $_POST["banktype"]; $_SESSION["accname"] = $_POST["accname"]; $_SESSION["accnumber"] = $_POST["accnumber"];
-
your not posting the values so these are blanking them out $_SESSION["ic"] = $_POST["ic"]; etc etc change to if(isset($_POST["ic"])) { $_SESSION["ic"] = $_POST["ic"]; } etc etc
-
to be truful its pratice, pratice, pratice hence i jump on these questions, i have a book "O'REILLY ~ Mastering Regular Expressions, 3rd Edition" 3rd edition has a few pages on PHP i have read about 1/3 but have be playing Regular Expressions alot i'll resume reading it soon google "Regular Expression Cheat Sheet" may help