-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Basic example i think it makes sense (untested) <?php require_once ('connect.php'); require_once ('opendb.php'); if (isset($_POST['update'])) { if(isset($_POST['ID'])) { $ID = (int)$_POST['ID']; $account_name= $_POST['company_name'] ; $city = $_POST['city']; $query = "UPDATE zipcodes SET (company_name, city) VALUSE ('$account_name', '$city') WHERE search_id='$ID'"; $result = @mysql_query ($query); }else{ echo "<p>Error, please try again"; } } $groupid_sent = (int)$_GET['groupid']; $query = "SELECT * FROM zipcodes WHERE search_id='$zip_id'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { // Database Values $groupid_sent= $row['account_name'] ; $account_name= $row['company_name'] ; $zip_id = $row['search_id'] ; $zipcode = $row['zipcode']; $city = $row['city']; $rank = $row['rank']; $redirect_url = $row['redirect_url']; $notes_1 = $row['notes_1']; $phone_number = $row['phone_number']; $groupe_name = $row['groupe_name']; $on_off = $row['on_off']; $test_zip = $row['test_zip']; echo "Edit Zip Code <b>$zipcode</b> for $account_name"; echo "<form>"; echo "<input type='hidden' name='ID' value='".$_GET['ID']."' >"; //ADDED //You need to Fix the Types and names (include the single quotes echo "Company Name: <input type=text name=company_name1 size=75 value='$account_name' > <br>"; echo "Zipcode: <input type=text name=zipcode1 value='$zipcode' > <br>"; echo "City: <input type=text name=city1 size=50 value='$city' ><br>"; echo "Rank: <input type=text name=rank1 value='$rank' ><br>"; echo "Redirect URL: <input type=text name=redirecturl1 size=75 value='$redirect_url' > <br>"; echo "Notes: <input type=text name=notes1 value='$notes_1' ><br>"; echo "Phone Number: <input type=text name=phonenumber1 value='$phone_number' ><br>"; echo "Group Name: <input type=text name=groupname1 value='$groupe_name' ><br>"; echo "On / Off: <input type=text name=onoff1 value='$on_off' ><br>"; echo "Test Zip: <input type=text name=testzip1 value='$test_zip' ><p>"; echo "<input type=submit name=submit value=update>"; echo "</form>"; } ?>
-
humm, do you have other code that connect to the MDB (that works)? i am not sure if you can send multiple statments to ADODB Connection... i would normally write the code like so.. $conn = new COM("ADODB.Connection") or die("Cannot start ADO"); // Microsoft Access connection string. $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$thisfolder/scheduler.mdb"); // SQL statement to build recordset. $rs = $conn->Execute("INSERT INTO User (`Employee title`, `Employee surname`, `Employee forename`, `Job title`, `Area coverage`, `Email address`) VALUES ('$Title', '$Forename', '$Surname', '$JobTitle', '$AreaCoverage', '$Email');"); But i don't use PHP with MS access, so i am probably wrong!
-
Can you post the code (in code tags) so we can see, Form and Code please
-
So removing duplicate Database entries etc Kinda very open ended question! still need more details.. how you idenify what need to be removed ? ie duplicate subject (i assume your DB has a subject field) the fact is we need a ton more info
-
[SOLVED] preg_replace how to allow ^a-z0-9-,._
MadTechie replied to sayedsohail's topic in Regex Help
just means 0 or more occurances of the previous set.. the fact is you don't need it for that. -
[SOLVED] ftp_put - Adds empty lines between every line on upload.
MadTechie replied to haaglin's topic in PHP Coding Help
its true script should be sent via ASCII, and uploading via BINARY can cause problems (ie error 500) but its worth a shot, i have used it a few time.. infact i have had to upload a zip and use the server tools to unzip the files to get them to work on a server. thats why i said "Try" switching to binary -
[SOLVED] preg_replace how to allow ^a-z0-9-,._
MadTechie replied to sayedsohail's topic in Regex Help
your replacing everything except a-z0-9 ,.'- now you have to escape the single quote as were using that to quote the string to ' becomes \' you don't need the * -
[SOLVED] preg_replace how to allow ^a-z0-9-,._
MadTechie replied to sayedsohail's topic in Regex Help
$var1 = preg_replace('/[^a-z0-9 ,.\'-]*/i', '', $var1 ); //clean chars $var1 = preg_replace('/\s{2,}/i', ' ', $var1 );//clean spaces as a note this should be in the RegEx Section -
check the Mail Settings in the PHP.INI file and update them with the correct SMTP/POP settings,
-
[SOLVED] ftp_put - Adds empty lines between every line on upload.
MadTechie replied to haaglin's topic in PHP Coding Help
try switching to FTP_BINARY.. also on some FTP server theirs an option to resolve this, its a common problem when a file is written on a Macintosh then opened on a PC, -
shouldn't the RegEx be this $string = "Hello"; $n=2; $string = preg_replace('/^(.{0,$n})(.)(.)(.*)/', '\1\3\2\4', $string ); EDIT: added $n
-
[SOLVED] HELP!Cant convert to integer from string format!!!
MadTechie replied to jigen7's topic in PHP Coding Help
The RegEx is wrong your returning try this <?php $X = yahoo_linkdomain("test.com"); $X = (int)$X; var_dump($X); function yahoo_linkdomain($url){ $ch = curl_init(); $url = preg_replace("/^(http:\/\/)?([^\/\?]+)([\/|\?])?(.+)?$/", "\$2\n", $url); curl_setopt($ch, CURLOPT_URL, 'http://search.yahoo.com/search?ei=UTF-8&fr=sexp-rd&p=linkdomain%3A'.urlencode($url).'+-site%3A'.urlencode($url)); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FILETIME, true); $total = curl_exec($ch); curl_close($ch); if (preg_match('%<span id="infototal">([\d,]*)</span>%si', $total, $regs)) { $strip = preg_replace('/,/', '', $regs[1]); //remove commas, could add (int) here if you want! } return $strip; } ?> -
Your really need to look into COM's or a word parser.. basic MS Word spellcheck via COM
-
Working with a bar code scanner, question.
MadTechie replied to NerdConcepts's topic in PHP Coding Help
will work but only with 1 barcode length, if you wanted to extend it your need to add a timer so if its set to 9 chars wait for 2 seconds, if its still at 9 chars then submit else wait 2 seconds, after 6 seconds (assume a problem and clear) this will allow you to use different length barcodes etc.. but it really depends on how complex you want to go -
thats because team is NOT an array, its a string.. so to make life easier lets convert it to an array <?php $gameqry = "INSERT into games (playerID, oppositionID, gameSeason, teamID) VALUES "; $teamArray = explode(", ",$_SESSION['creatematch']['team']); foreach ($teamArray as $team) { $gameqry .= "('" . $team . "', '" . $_SESSION['creatematch']['opposition'] . "', '" . $_SESSION['creatematch']['season'] . "', '" . $_SESSION['creatematch']['ottersteam'] . "'),"; } ?> //untested (written on the fly)
-
changing css in the calender date(urgent)
MadTechie replied to localhost1's topic in PHP Coding Help
try this if statement $dayno = (int)$pieces[2]; if($i==$dayno) -
changing css in the calender date(urgent)
MadTechie replied to localhost1's topic in PHP Coding Help
i'm not sure what your asking.. i assume that the holiday_date field stores the date as year-month-day you may have problems with the day if the day is 03 instead of 3.. -
can you post the results of this print_r($_SESSION['creatematch']); in code tags also you loop an array without counting foreach ($_SESSION['creatematch']['team'] as $team) { $gameqry .= "('" . $team . "', '" . $_SESSION['creatematch']['opposition'] . "', '" . $_SESSION['creatematch']['season'] . "', '" . $_SESSION['creatematch']['ottersteam'] . "'),"; }
-
[SOLVED] How to extract from one table into another
MadTechie replied to bri4n's topic in PHP Coding Help
maybe a script to loop throught the records and just insert a new records in the new/archive table, and set that to run once a month in a cronjob! or set a timestamp to check to see if the records has been archive and run if it hasn't -
[SOLVED] transferring excel data to mysql table
MadTechie replied to shane07's topic in PHP Coding Help
LOL , (s)he offline.. oh well -
changing css in the calender date(urgent)
MadTechie replied to localhost1's topic in PHP Coding Help
well their a few bug but your need to give some more detail as a note the most common problem i see here is.. echo "<td class=".$date_class."> should be echo "<td class='".$date_class."'> you need to quote the class names try viewing source and check to see if the class is being set -
changing css in the calender date(urgent)
MadTechie replied to localhost1's topic in PHP Coding Help
Yes.. -
displays fine on mine! try changing to $html= preg_replace('/(\r|\n|\r\n){2,}/i', '\1', $html);
-
Erm.. code tags would be been nice.. also this a kinda php/javascript problem.. have you tried viewing the parsed file to see if its correct ? if so its a JS problem if not you shoud see what part is wrong and beable to post the problem section!
-
changing css in the calender date(urgent)
MadTechie replied to localhost1's topic in PHP Coding Help
add $class_bg[$i]=""; above the while($row=mysql_fetch_array($result)) so $class_bg[$i]="";//your standard class for dates while($row=mysql_fetch_array($result))