taquitosensei
Members-
Posts
676 -
Joined
-
Last visited
-
Days Won
2
Everything posted by taquitosensei
-
Output count result to html even if 0
taquitosensei replied to gamma1itman's topic in PHP Coding Help
You could try this $resulta=($result<1)?0:$result; -
MP3 files - selecting a start and end point using PHP
taquitosensei replied to willothewisp's topic in PHP Coding Help
What happens if you run your ffmpeg command on the command line? That would be the first thing to check. If that works then it's probably an issue with permissions for php creating the file. -
Arrays from MySQL database contains no data? (Simple Q)
taquitosensei replied to rjt90's topic in PHP Coding Help
Then you need to explode it before you do this. foreach ($var_hook as $id) { $series[$id] = array(); } It's a string because you imploded it before your sql. -
Arrays from MySQL database contains no data? (Simple Q)
taquitosensei replied to rjt90's topic in PHP Coding Help
or "SELECT * FROM data WHERE data_id IN (".implode(",", $var_hook).") ORDER BY time_id ASC" -
This will substract two dates and give you the difference in hours/minutes. Like DaveyK said if you add 7 days to a timestamp then subtract the original timestamp from it. You will always get exactly 7 days. $diff = strtotime($timestamp2) - strtotime($timestamp1); $hours = floor($diff / 3600); $diff %= 3600; $minutes = floor($diff / 60);
-
You can do print_r($_REQUEST); at the top of phpdoc.php to see what kind of values are actually being posted. If you do that you should be able to see right away why this isn't working.
-
It looks like you're not selecting the size. SELECT Food,Calories FROM food order by Food
-
How permanent do you want it? If it's permanent permanent I would store it in a database somewhere. If it's just somewhat permanent, since you're already using jQuery, use jQuery.ajax to post to server and store a session variable. Then use that session variable to determine whether it's dead or not when initially loading the page.
-
It does effect the query. Because in first query the value you're getting is '' The second query you're getting a number.
-
As far as I know UNION removes duplicate rows, so the count(distinct contactid) in the second part would make it not a distinct row. So in your query you're getting everything, then everything with activity in the last week.
-
Making the result of a variable a variable itself
taquitosensei replied to elmas156's topic in PHP Coding Help
use a double $$ $$row[0]="n"; -
Call to undefined function sqlsrv_connect()
taquitosensei replied to ncurran217's topic in PHP Coding Help
Did you install the php drivers? http://www.microsoft.com/en-us/download/details.aspx?id=20098 -
Also to make this cleaner you could do something like this $fields=array("objava","vpr01","vpr03","etc"); foreach($fields as $field) { if(isset($_POST[$field])) { fwrite($fh, $_POST[$field]."\r\n"); } }
-
Quick question that is driving me insane.
taquitosensei replied to amg182's topic in PHP Coding Help
you're outputting a blank line before the session start which starts the headers so then your session start can't start. -
pear is a set of php files. If your web server can parse php files then you can use pear. It's just not in the default location for the operating system. Just upload the "pear" folder from your local machine to the web server. Then set the include path. Then call the files as normal.
-
why can't you use pear? You should be able to just put your pear directory tree in an includes folder and include the files you need. For example if on your local system pear is in /usr/share/pear or something like that, and your web root is /var/www/vhosts/yourwebsite.com put the pear folder in /var/www/vhosts/yourwebsite.com/includes/ then set the include path ini_set("include_path",$_SERVER['DOCUMENT_ROOT']."/includes/".PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT']."/includes/pear/".APATH_SEPARATOR.ini_get("include_path"));
-
echo it out to make sure it looks right $sql="insert into gallery ('imgpath') values ('$filename')"; echo $sql; // this will show if there's something obvious causing a problem $result=mysql_query($sql); print_r($result); //this will tell you if there's actually an error with the syntax
-
You probably have an auto increment value in your table and if you don't list the fields it uses all fields including the auto increment. You'll need to specify your fields. mysql_query("insert into $rekrytering(field1,field2,field3) values ('" . $recruit . "', '" . $nyttidn . "', '" . $datum . "')")
-
I made a typo and was mixing up mysql and mysqli it should be while($row=mysqli_fetch_assoc($result)) { }
-
change this // Fetch the results. $row = mysqli_fetch_array($result); // Print the results: $output[] = '<ul>'; $output[] = '<li>'.$row['title'] .': £'.$row['price'].'<br /><img src="'.$row['img'].'" alt="'.$row['title'].'" /></li>'; $output[] = '</ul>'; echo join('',$output); to this $result=mysqli_query($dbc,$query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $output[] = '<ul>'; $output[] = '<li>'.$row['title'] .': £'.$row['price'].'<br /><img src="'.$row['img'].'" alt="'.$row['title'].'" /></li>'; $output[] = '</ul>'; } echo join('',$output);
-
You don't change the name of the include file. That way all you have to do is edit the single include file to add/edit/remove an include. Plus auto including files in a folder could be a big security risk.
-
this line $target_path = $target_path . time() . '_' . basename( $_FILES['file']['name']); adds a timestamp to the beginning of the filename should be $target_path = $target_path . basename( $_FILES['file']['name']);
-
try this. increment a variable then check the remainder e.g. $a=3; $a%3==0; echo ($a%3==0)?"<br>":""; $a=0; while($row = mysql_fetch_array($fetchdata)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; echo (($a%3)==0)?"<br>":""; echo "<div class='productpagemenu'> <div class='productpagedescription'> <center> <a href='$link' target='_blank' >$description</a> </center> </div> <div class='productpageimage'> <center> <a href='$link' target='_blank'><img src='$image' width=\"95%\"/></a> </center> </div> <div class='productpageprice'> <center> <center>&#163; $price</center> </center> </div> <div class='productpagepricebutton'> <center> <center><a href='$link' target='_blank' ><img src=/images/buybutton.png /></a></center> </center> $i </br> </div> </div>"; $a++; }
-
else { echo not working at the end of a table
taquitosensei replied to mattc_uk's topic in PHP Coding Help
the last else only shows if no search term was entered. Try this. $result = mysql_db_query("cookuk_pn", $query); if(mysql_num_rows($result)==0) { echo "Your query returned 0 Results"; } else if ($result) { echo "Your output." } -
have a php page with all your includes then include that page at the top of each page that needs them phpincludes.php include('page1.php'); include('page2.php'); include('page2.php'); // etc then include('phpincludes.php');