330 Posted Topics
Re: Pass the `$sku` to the sendMail function: `$this->sendMail($finalMessage, $sku);` then add the conditional around the email address, you could make it simple and make the `$sku` variable say `'lots_of_orders'` if he has over 10: $cut_sku = substr($sku, 0, 1); if($sku == 'lots_of_orders'){ $emailTemplate->setToEmail('[email protected]'); }elseif($cut_sku == '1'){ $emailTemplate->setToEmail('[email protected]'); }elseif($cut_sku == '2'){ … | |
Re: In your conditional statement I spot to things wrong you are using the wrong reference to the variable it should be `$row['BILLED_TO_DATE_PERCENTAGE']`and also when doing a comparison you use `==` to test if 2 values match, using a single `=` tells PHP to set the variable to the following value, … | |
Re: line 20 has a . instead of a ; also line 31 needs to be `echo '` | |
Re: Hi Chloooo, What you want to use is an array. var images = []; var imageDisplay = 0; images.push({title:'My Image Title 0', src:'myimage0.jpg'}); images.push({title:'My Image Title 1', src:'myimage1.jpg'}); images.push({title:'My Image Title 2', src:'myimage2.jpg'}); function displayImage(){ document.images["pic"].src = images[imageDisplay].src; document.images["pic"].alt = images[imageDisplay].title; imageDisplay++; if(imageDisplay > images.length-1){ imageDisplay = 0; } } … | |
Re: You can also output a pdf through PHP, you just need to set the header as a pdf: [headers for pdf download](https://stackoverflow.com/questions/20080341/correct-php-headers-for-pdf-file-download) (and just take off the dowload part). If you did that you would have more control over where the pdf jumps to on opening, for example you could … | |
Re: No. If you find wordpress is replacing your job as a web developer, you are not a web developer. | |
Re: Hi Kathy, How I would debug this is to put`var_dump($_POST);exit;` at the top of file 2 so you can see what is actually being sent. Also with a redirect it is best to do it within PHP not with javascript: `header("Location: http://www.example.com/");exit;` Javascript is client-side so the user can disable … | |
Re: For the mysql import copy paste line 3-11 into a php file, update the file/table names I dont quite get how the mysql import works. For the csv export copy paste lines 16-103 into a php file, and update the file & table name at the top I should also … | |
Re: I've written some ajax that will do that, i'll dig it out and edit it for you. <script type='text/javascript'> function getXMLHTTPRequest() { var req = false; try { /* for Firefox */ req = new XMLHttpRequest(); } catch (err) { try { /* for some versions of IE */ req … | |
Re: Pretty rough but you could pull the amount of duplicates and increment them in the php script $Next = mysql_query("SELECT `fields`,count(*) AS `numposts` FROM $logbook WHERE Date>='$Date' AND ID!='$ID' GROUP BY `date` ORDER BY Date, id LIMIT ".$numposts+1.",1"); $Prev = mysql_query("SELECT `fields`,count(*) AS `numposts` FROM $logbook WHERE Date<='$Date' AND ID!='$ID' … | |
Re: @wayko $array = array( 0=>array('fname'=>'john','sname'=>'smith','age'=>32) ,1=>array('fname'=>'Bill','sname'=>'Bailey','age'=>22) ,2=>array('fname'=>'Fred','sname'=>'Kruger','age'=>0) ); foreach($array as $v){ $sql = "INSERT INTO people (fname,sname,age) value ('{$v['fname']}','{$v['sname']}',{$v['age']})"; //execute $sql here or it will overwrite on loop mysql_query($sql); } ![]() | |
Re: if (($i = array_search($ip, $deny_ips)) !== FALSE){ // user is blocked: print "<CENTER> YOU HAVE BEEN BANNED ! </CENTER>"; exit; } Not sure if that will work, makes more sense to me like this: if (array_search($ip, $deny_ips) !== FALSE){ // user is blocked: print "<CENTER> YOU HAVE BEEN BANNED ! … | |
Re: I did a wedding ring site awhile ago, i did it by assigning each product the weight of the precious metal contained in it then having the price displayed on the page by doing: `$price = ($goldprice*$goldweight);` So i would get the `$goldprice` to be pulled from the xml file … ![]() | |
Re: <style type='text/css'> #myDiv{ box-shadow: 5px 5px 20px #cccccc;// x, y, blur, colour } </style> I forget which one is x and which is why but thats the format, some browsers might want their prefix still but should be standardised to the above now -webkit-box-shadow: 5px 5px 20px #cccccc; -moz-box-shadow: 5px … | |
Re: It's the content of the top row making the first row expand to fit it, adding this shows the rows going to standard size #lmifp td { white-space:nowrap; } maybe make the td larger to fit the text and have `overflow:hidden;` would solve it but thats your say on what … | |
Re: <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['date', 'Number of clicks per hari'], <?php $data = array( '1'=>array('date'=>'2013-01-16','numclicks'=>'6'), '2'=>array('date'=>'2013-01-17','numclicks'=>'9'), '3'=>array('date'=>'2013-01-18','numclicks'=>'5'), '4'=>array('date'=>'2013-01-19','numclicks'=>'12'), '5'=>array('date'=>'2013-01-20','numclicks'=>'10'), ); //$resultday = mysql_query("SELECT `date`,COUNT(idads) AS `numclicks` FROM adsmgt GROUP BY date") or die(mysql_error()); $i = 0; … | |
Re: Don't know if your login is going to be public but for a public account creating site you want to hash the passwords so they arn't stored in a database and there's no reason you can't use hash for private uses. CREATE TABLE `users` ( `uid` int(5) NOT NULL AUTO_INCREMENT, … | |
Re: Left join does that well: SELECT * FROM `category` `c` LEFT JOIN `sub_category` `sc` ON `c`.`cat_id` = `sc`.`cat_id` WHERE `c`.`cat_id` IN(1,3,8) you can use group by's to count up how many times a field occurs too eg. how many subcats each category has SELECT `c`.`cat_id`,count(*) as `num_subcats` FROM `category` `c` … | |
Re: INSERT INTO `table` (`field`,`field2`,`field3`) VALUES ('value1','value2',4); or expanding on the select query pritaeas posted, for different table structures INSERT INTO `table` (`fielda`,`fieldb`,`fieldc`) select `field1`,`field2`,`field3` FROM `table2`; | |
Re: you have a element on the page with the id 'list'? theres also an extra </script> tag in there but that might just be a copying error Since i didnt write the package and havn't used it i can only suggest using the javascript console to check for errors | |
Re: my advice would be to get something you want to create or find someone you can create something for at a cheap price, then go do it and google each part you want to do: "how do i ..." "session not working" "date()" and read the info on them and … | |
Re: I'm having a look at it - looks like a challenge! indexes were missing on these - dropped the query from 90 seconds to 6 seconds for me CU.comp CU.user CG.comp CG.game P.user | |
Re: Do you have a way of connecting into an admin mysql like phpmyadmin or by logging into the server? the mysql_connect() details must be incorrect `$con = mysql_connect('localhost','root','');` mysql_connect($host,$user,$pass); also i suggest using mysqli instead mysqli_connect($host,$user,$pass,$db); mysql_ is being phased out sometime in the future so may as well start … | |
Re: in actionscript I would make it with an array formatted to be understandable eg. var grid = new Array(1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16, 17,18,19,20, 21,22,23,24); Once you see that format its much easier to grasp how to make it up, i just done random numbers here since you said afterwards you … | |
Re: Theres no name attribute on any of the select boxes <select name='databasecol'> while($row = mysql_fetch_assoc()){//while looping through each database row echo "<input type='hidden' name='unqid'' value='{$row['unique_id']}'/>\r\n"; echo "<input type='hidden' name='form_submit' value='SUBMITTED'/>\r\n";//may want to create a random token instead to prever multi submitting //inputs name= db_field_name } //top of page if(ISSET($_POST['form_submit']) && … | |
Re: I didn't go to uni so i don't know that linguo, what is it you want? (SELECT id, place, idParentPlace, 1 AS hierarhic FROM places WHERE idParentPlace IS NULL) UNION (SELECT id, place, idParentPlace, idParentPlace + 1 FROM places WHERE idParentPlace IS NOT NULL) Maybe this is what you are … | |
Re: $result=mysqli_query($mysqli,"SELECT reserv_id,tableselect FROM reserve WHERE reserveDate = '". $date ."' AND reserveTime = '". $time ."'"); $reserves = array();//php $reserveJSArray = 'var reserveArray = {'; if($row = $result->fetch_array(MYSQLI_ASSOC)){ echo $row['tableselect']; $i = 0; if($t){ $reserves[$row['reserv_id']] = 1; //or if($i == 0){ $tmpJS = $row['reserve_id'].': = 1'; $i++; }else{ $tmpJS .= … | |
Re: Code sanity has been restored, bar the p tag's class name - I let that one through <style type='text/css'> .spanp{display: inline-block;margin:0;} .dotuline{display: inline-block;border-bottom-style: dotted;border-bottom-width:2px;margin:0;} .box{ width:700px;padding:30px;border:1px solid black;margin:1px;display:block;} </style> <div class="box" align="left"> <table width="100%" border="0"> <!--<?php //while($row = mysql_fetch_assoc($res)){?>--> <tr> <td width="45%" > <p class="spanp" style="width:20px">Alias:</p> <p class="dotuline"><?php echo $alias; … | |
Re: <?php //parse form and add inventory to system if(isset($_POST['productName'])){ $productName = mysql_real_escape_string($_POST['productName']); $price = mysql_real_escape_string($_POST['price']); $category = mysql_real_escape_string($_POST['category']); $description = mysql_real_escape_string($_POST['description']); //check if product name ios already in use echo 'Name:'.$productName."<br/>\r\n"; $query = "SELECT id FROM products WHERE productName = '$productName' LIMIT 1"; echo 'Query:'.$query."<br/>\r\n"; $sql = mysql_query($query) or die(mysql_error()); … | |
Re: Most of the message is being echo'ed out not appended to the message var - plus theres back slashes around all the quotes $message = '<html> <head> <title>'.$subject.'</title> </head> <body> <table align="center" cellspacing="3" cellpadding="3" width="100"> <tr> <th align="left"><b>Player Name<b></td> <th align="left"><b>Number of Goals<b></td> </tr>'; while($row_GetCurMonthPlayerGoals = mysql_fetch_assoc($GetCurMonthPlayerGoals)) { $message .= … | |
Re: To confirm it I really doubt there will be any way to import a xls into mysql - microsoft has xls files saved in an encrypted format that you need a program to translate - I would do what Pritaeas says and you can make the top row using the … | |
Re: I put together a working example of using time() to convert datetime's into integar's: <?php $now = time(); $testTimes = array('test 1'=>time()+(60*60*16),'test 2'=>time()+(60*60*24*6),'test 3'=>time()-60*30);//test times - array(16 hours,6 days, 30 minutes ago); //$timetocheck = strtotime('2012-01-18 13:25:12');//to convert a string date or datetime into a time integar $triggerTime = 60*60*24*2;//seconds * … | |
![]() | Re: *What I want to do is, if they press refresh on their browser, not process the data again. However, if they select the same item from the drop-down and submit it again then this should work. Is there a way to do this?* For that you can use some part … |
Re: Heres an old ajax file i found and edited for you: daniweb_basic_ajax_example.php <html> <head> <script type='text/javascript'> function getXMLHTTPRequest() { var req = false; try { /* for Firefox */ req = new XMLHttpRequest(); } catch (err) { try { /* for some versions of IE */ req = new ActiveXObject("Msxml2.XMLHTTP"); … | |
Re: What a confusing thread to follow! Your first query is a group by - which is what you're after and you get the counts without any other data the second query has no group by on it - its just pulling all rows and concatting a var from the last … | |
Re: This code is correct: <?php include "connect.php"; $query = "SHOW TABLES FROM `my_database`"; if($res = mysql_query($query)){}else{die(mysql_error());} $selectedTable = 'table'; echo "<select name='venue'>"; while ($row = mysql_fetch_row($res)){ echo "<option value='{$row[0]}' "; if ($selectedTable == $row[0]){ echo " selected='selected'";//<-- added space } echo ">{$row[0]}</option>"; } echo "</select>"; ?> Working on it i … | |
Re: be impossible to get 100% of the data back, 2012-01-04 and 2012-04-01 both valid dates and no idea which format it was entered as, you could get the obvious ones though, i'd use a combo of substr() and locate() SELECT SUBSTR('2012-22-07',LOCATE('-',CURDATE())+1,2) AS `second_num`; SELECT SUBSTR('2012-22-07',LOCATE('-',CURDATE())+4,2) AS `third_num`; then you can … | |
Re: Heres one i got: $.post("http://www.example.co.uk/test.php",{sid:sid,type:type}, function(data){ $('.jq_counttotal').html(data); } ); Looks like yours is missing the "what to do when got page" function buttons: { "Save": function() { $.post('../includes/additem.inc.php', $('#additemform').serialize(), function(data){ alert(data); } ); }, Cancel: function() { $( this ).dialog( "close" ); } } | |
Re: die('Invalid query: ' . $conn->error); maybe that? | |
Re: Looks like you need to give your uploads an id and that task table needs an id then you pass the task id into the upload or the upload id into the task and pull across the full path instead of just the filename. and then also make the form … | |
Re: Maybe OTT but it was fun. heres an example of progress bar in JS <html> <head> <script type='text/javascript'> var barLength = 260; var progress = 0; var progressEnd = 200; var progressBarCurrent = 0; var tickSpeed = 300; function setProgressBar(obj,barLength,progress,progressEnd){ if(progress < 0){ obj.style.width = '0px'; }else{ var percentage = … | |
Re: <select name="batch" onchange="submit();"> <option value="-1" >-- Select Address --</option> <?php $result = mysql_query('SELECT `PO`,`namn` FROM PO ORDER BY PO ASC') or die(mysql_error()); //php arrays are case sensitive, the field was defined in caps //you can use SELECT `po` to make it lower case in the mysql pull //var_dump($result);//$result will be … | |
Re: Thats because ` $albums = Album::find_all();` returns an array public static function find_all() { return self::find_by_sql("SELECT * FROM ".self::$table_name); } public static function find_by_sql($sql="") { global $database; $result_set = $database->query($sql); $object_array = array(); while ($row = $database->fetch_array($result_set)) { $object_array[] = self::instantiate($row); } return $object_array; } You will want a starter … | |
Re: theres a way around ajax for non changing data - which is preloading the data. <script type='text/javascript'> var abcData = new Array(); <?php $data = array( '1'=>array('id'=>'1','description'=>'desc 1'), '2'=>array('id'=>'2','description'=>'desc 2'), '3'=>array('id'=>'3','description'=>'desc 3') ); foreach($data as $v){ echo "abcData[{$v['id']}] = 'option {$v['id']} data: {$v['description']}';\r\n"; } ?> function updateView(obj){ var target = … | |
Re: <form action="register.php" method="post"> action = the page/script to submit the data to on form submission method = the way in which the data is sent to the script Firstname: <input type="text" size=30 name="fname"><br> Lastname: <input type="text" size=30 name="lname"><br> method POST - will send the contents of "fname" and "lname" to … | |
Re: [CODE=mysql]select * from `tablea` left join `tableb` on `tablea`.`id` = `tableb`.`id` left join `tablec` on `tablea`.`id` = `tablec`.`id`[/CODE] result set will have the fields of tableb & c attached as columns on the right of tablea matched up by the `id` fields matching. | |
Re: You're going to have to describe it better than that. | |
Re: > function getSize() { > if (isset($_SERVER["CONTENT_LENGTH"])){ > return (int)$_SERVER["CONTENT_LENGTH"]; > } > else { > throw new Exception('Getting content length is not supported.'); > } > } thats an error on this bit, check your php ini settings - sounds like that server variable isn't being set You may … | |
Re: sounds like you could play with this randstr function i got: function randStr($len = 6){ if(is_int($len) && $len > 0){ $string = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',$len)),0,$len); }else{ $string = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',6)),0,6); } return $string; } $id = randStr(10); | |
Re: setcookie("email", $email1); setcookie("pass", $pass1); setcookie("ID", $ID); should be: setcookie("email", $email1,time()+3600); setcookie("pass", $pass1,time()+3600); setcookie("ID", $ID,time()+3600); //setcookie(cookie name, cookie value, cookie expire unix timestamp); //time() = NOW in seconds since 1970, -3600 would make it expire an hour ago |
The End.