PHP - Unable To See The Header
Hi all,
I am not sure why my header is not displaying the header image after using the CSS
I have a png file that repeats horizotally.
Please help
<!DOCTYPE html>
<html> <head> <meta charset="UTF-8"> <title>Wikigets The online store</title> <style type="text/css"> body { margin:0 px;} #pageTop { background: url(style/headerline1.png); height:110 px; } </style> </head> <body> <div id="pageTop"> </div> <div id="pageMiddle"></div> <div id="pageBottom"></div> </body> </html> headerline1.png 2.82KB 0 downloads headerline1.png 2.82KB 0 downloads Similar TutorialsHello everyone, I'm just starting out with PHP as I need to create an online bookstore for a school project. I'm working by a magazine which should teach you exactly how to do this using PHP, but I've had a bunch of problems with the code they use and I don't really know what's going on. Anyway, this looks really simple and basically what it does is allows you to post a comment on a book, then returns you to the book's page. Problem is, I'm getting the Header may not contain more than a single header, new line detected. error and I can't figure out why. I've tried researching into the matter but all the cases I found had to do with returning to an url, which is not my case. Anyway, here's the snippet of code: The form: Code: [Select] <div style="width:400px; border:1px solid #ffffff; background-color:#F9F1E7; padding:5px"> <b>Adauga opinia ta:</b> <hr size="1"> <form action="adauga_comentariu.php" method="POST"> Nume: <input type="text" name="nume_utilizator"><br><br> Email: <input type="text" name="adresa_email"><br><br> Comentariu: <br> <textarea name="comentariu" cols="45"></textarea><br><br> <input type="hidden" name="id_carte" value="<?=id_carte?>"> <center><input type="submit" value="Adauga"</center> </form> </div> The script adaugare_comentariu.php: Code: [Select] <?php ob_start(); include("conectare.php"); $numeFaraTags=strip_tags($_POST['nume_utilizator']); $emailFaraTags=strip_tags($_POST['adresa_email']); $comentariuFaraTags=strip_tags($_POST['comentariu']); $sql="insert into comentarii (id_carte, nume_utilizator, adresa_email, comentariu) values(".$_POST['id_carte'].", '".$numeFaraTags."','".$emailFaraTags."','".$comentariuFaraTags."')"; mysql_query($sql); $inapoi="carte.php?id_carte=".$_POST['id_carte']; header("location:urldecode($inapoi)"); ob_end_flush(); ?> conectare.php connects to the mysql database. $inapoi is the variable which returns the user to carte.php (the book he posted a comment on), where id_carte is the book's unique id. I'm getting Header may not contain more than a single header, new line detected on line ten, which is the header line. Can anyone help me? I've been stumped on this for a few days now and I've just let it pass and started working on other bits, but it's bugging me too much and I'd like to fix it. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=350027.0 Hello, I've never really used the update command before for mysql and I'm attempting to use it and struggling a little bit. I'm trying to use mysqli prepared statements.. here's the code that I have thus far: if($query = $database->connection->prepare("UPDATE videos SET comments=?, views=?, uploader=? WHERE title = ?")) { $query->bind_param('iiss', $comments, $views, $uploader, $title); $query->execute(); $result = $query->affected_rows; $query->close(); } For some reason I cannot get this working. I have created a modification page for the administrators to be able change any of the values and wanting to update the database to reflect the changes. When using the MySQL UPDATE command do all of the values have to get changed or modified, or am I able to pass back some of the same values? Like with the above code.. if I only wanted to update the views, would I still be able to just pass in the same values for comments and uploader and it would just replace the values? I get the unable to jump to row zero mysql error. Code: [Select] function is_admin($uid, $cid) { $uid = (int)$uid; $cid = (int)$cid; $sql = "SELECT `users`.`id` AS `uid`, `companies`.`companyid` AS `cid`, `companies`.`adminid` AS `aid` FROM `companies` LEFT JOIN `users` ON `users`.`id` = companies.adminid WHERE `users`.`id` = {$uid} AND `companies`.`companyid` = {$cid}"; $user = mysql_query($sql); return (mysql_result($user, 0) == '1') ? true : false; } Code: [Select] <?php function checking_out() { $conn = db_connect(); $nickname=$_SESSION['valid_user']; $query="select sum(price) from preorders where name='".$nickname."'"; $result = $conn->query($query); if ($result) { echo '<h1>'.$result.'</h1>'; } } ?> This is not working, there is no result in the browser, any idea ? HI, When I trying to covnert 3gp to FLV I got this error: FFmpeg version SVN-r12665, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilt er-lavf --enable-pthreads --enable-liba52 --enable-avisynth --enable-libfaac --e nable-libfaad --enable-libgsm --enable-memalign-hack --enable-libmp3lame --enabl e-libnut --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --cpu=i686 --extra-ldflags=-static libavutil version: 49.6.0 libavcodec version: 51.54.0 libavformat version: 52.13.0 libavdevice version: 52.0.0 built on Apr 2 2008 22:35:11, gcc: 4.2.3 Seems stream 0 codec frame rate differs from container frame rate: 29.97 (30000/ 1001) -> 15.00 (15/1) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'uploads/v_1.3gp': Duration: 00:01:03.6, start: 0.000000, bitrate: 189 kb/s Stream #0.0(und): Video: h263, yuv420p, 176x144 [PAR 12:11 DAR 4:3], 15.00 t b(r) Stream #0.1(und): Audio: samr / 0x726D6173, 8000 Hz, mono WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s Output #0, flv, to 'uploads/a.flv': Stream #0.0(und): Video: flv, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 20 0 kb/s, 15.00 tb(c) Stream #0.1(und): Audio: libmp3lame, 22050 Hz, mono, 0 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Unsupported codec (id=73728) for input stream #0.1 What should I do? Thanks Unable to execute query (SELECT * FROM lb-players) in the database : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-players' at line 1 I don't know why i am getting this error. All i can think of that is taking away lb from "lb-players" when you add a " - "? Code: [Select] [m]<?php $conn = mysql_connect("23.23.23.23", "unknown", "itsAsecertxD");//ignore this xD if (!$conn) { echo "Unable to connect to the database : " . mysql_error(); exit; } if (!mysql_select_db("minecraft-rc")) { echo "Unable to select database mydbname : " . mysql_error(); exit; } $sql = 'SELECT * FROM lb-players'; $result = mysql_query($sql); if (!$result) { echo "Unable to execute query ($sql) in the database : " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to display."; exit; } while ($row = mysql_fetch_assoc($result)) { echo $row["playername"]; } mysql_free_result($result); ?>[/m] tell me if i posted this in the wrong place its been forever since i last been on this site :$ my firefox won't open up .tpl format im running apache...how can i view that format on my apache please? Hello....I am using ajax,jquery with php to insert data in db.....but the script is not working. form.html: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> label{ display:block; } </style> <script type="text/javascript" src="jquery-1.5.min.js"> </script> <script type="text/javascript"> $(function() { $('#submit').click(function(){ $('#container').append('<img src="ajax-loader.gif" id="loading" alt="image" />'); var name=$('#name').val(); var email=$('#email').val(); var d=$('#d').val(); var m=$('#m').val(); var y=$('#y').val(); var add=$('#add').val(); var phone=$('#phone').val(); $.ajax({ url: 'process.php', type: 'POST', data: 'name=' + name + '&email=' + email + '&d=' + d + '&m=' + m + '&y=' + y + '&add=' + add + '&phone=' + phone, success: function(result){ $('#response').remove(); $('#container').append('<p id="response">' + result + '</p>'); $('#loading').fadeOut(500,function(){ $(this).remove(); }); } }); return false; }); }); </script> </head> <body> <h2>User Registeration</h2> <form action="process.php" method="POST"> <div id="container"> Name:<br> <input type="text" name="name" id="name" /><br> Email:<br> <input type="text" name="email" id="email" /><br> Date Of Birth:<br> <input type="text" id="d" name="d" size="2" /> <input type="text" id="m" name="m" size="2" /> <input type="text" id="y" name="y" size="4" /><br> Address:<br> <input type="text" id="add" name="add" /><br> Phone:<br> <input type="text" id="phone" name="phone" /><br> <input type="submit" name="submit" id="submit" value="GO!" /> </div> </form> </body> </html> process.php My db id named "jquery" and table is "tab" Code: [Select] <?php $conns=mysql_connect("localhost","root",""); if(!$conns) echo "error in connection"; mysql_select_db("jquery", $conns); $name=$_POST['name']; $email=$_POST['email']; $m=$_POST['m']; $d=$_POST['d']; $y=$_POST['y']; $add=$_POST['add']; $phone=$_POST['phone']; echo $name,"<br>"; echo $email,"<br>"; echo $m, "<br>"; echo $d,"<br>"; echo $y,"<br>"; echo $add, "<br>"; echo $phone,"<br>"; $query="INSERT INTO tab (name,email,d,m,y,add,phone) VALUES ('$name',$email','$d','$m','$y','$add','$phone')"; if(!mysql_query($query,$conns)) echo "Error"; else echo "DATA inserted"; ?> The output shown is: pulkit pulkit@gmail.com 1 26 1991 lucknow 987576787 Error For some values i entered. Hello, I'm working with Zend Framework on Linux, and I'm trying to generate a CAPTCHA using Zend_Form_Element_Captcha. Whenever the CAPTCHA page loads I get this error: [12-Jan-2011 18:14:54] PHP Warning: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Unable to open '/var/www/square/application/../public/captcha/ebf44d292149b3ebda05571c54c463a8.png' for writing: Permission denied in /usr/local/zend/share/ZendFramework/library/Zend/Captcha/Image.php on line 563 Here's my code for generating the CAPTCHA: // create captcha $captcha = new Zend_Form_Element_Captcha('captcha', array( 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'width' => 300, 'height' => 100, 'imgUrl' => '/captcha', 'imgDir' => APPLICATION_PATH . '/../public/captcha', 'font' => APPLICATION_PATH . '/../public/fonts/LiberationSansRegular.ttf', ) )); I've checked permissions, and all directories mentioned above are accessible to root. Has anyone had a similar problem or have an idea how I can fix this? Kind Regards, Mike Hi guys, Currently my result displayed a 'comma' at the end Lower Primary English, Math, Science, Chinese, How do I remove the comma which is bold in red? Thank you so much My code Code: [Select] while($row3 = mysqli_fetch_array($data3)) { if ($row3['level_id'] == 2) { echo ''.$row3['subject_name'].', '; } } I have written my index.php script where after verifying the password the script displays the user's name. But the user name is not displayed by it. Here is my script Hey guys, After my php script a HTML code follows. But i can't edit the HTML code because it isn't recognised. It does show up, however i can't edit it. Problem: Unable to edit HTML code below php scripts Code: <?php function createNewFile($name,$mail,$subject,$comments,$count,$date,$other="",$up="0") { global $settings; $header=implode('',file('header.txt')); $footer=implode('',file('footer.txt')); $content=' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>'.$subject.'</title> <meta content="text/html; charset=windows-1250"> Thanks in advance Hi All,
I have this issue when upload a file using an uploader i made. For the life of me I cant figure out why it won't write the file.
Error:
[Sat Jun 21 20:45:40 2014] [error] [client xxxxxxx] AH01215: PHP Warning: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/tmp/phpUsCyXG' to '/home/sites/xxxxxx.co.uk/public_html/yourphotos/uploads/' in /home/sites/xxxxxxx.co.uk/public_html/yourphotos/index.php on line 31My PHP <?php //if they DID upload a file... $message = ''; if($_FILES['photo']['name']) { $valid_file = true; //if no errors... if(!$_FILES['photo']['error']) { //now is the time to modify the future file name and validate the file $new_file_name = strtolower($_FILES['photo']['tmp_name']); //rename file if($_FILES['photo']['size'] > (26214400)) //can't be larger than 25MB { $valid_file = false; $message = 'Oops! Your file\'s size is to large.'; echo $_FILES['photo']['size']; } if($_FILES['photo']['size'] < (1572864)) //can't be smaller than 1.5MB { $valid_file = false; $message = 'Oops! Your file\'s size is to small.'; echo $_FILES['photo']['size']; } //if the file has passed the test if($valid_file) { //move it to where we want it to be move_uploaded_file($_FILES['photo']['tmp_name'], '/home/sites/xxxxxxxx.co.uk/public_html/yourphotos/uploads/'); $message = 'Congratulations! Your file was accepted.'; } } //if there is an error... else { //set that to be the returned message $message = 'Ooops! Your upload triggered the following error: '.$_FILES['photo']['error']; } } ?> <html> <body> <form action="index.php" method="post" enctype="multipart/form-data"> Your Photo: <input type="file" name="photo" size="25" /> <input type="submit" name="submit" value="Submit" /> <?PHP echo $message; ?> </form> </body> </html>I have set the uploads file to have write permissions as well. Sam Edited by samtwilliams, 21 June 2014 - 02:51 PM. I wrote a very simple web form that allows my user to view text files from within their Internet browser. Occasionally, the search criteria entered returns more than one file. So I want to implement a feature whereby the text files returned by the search are compressed into a ZIP. I got a prototype working but it only compresses the first file. The second or third files are ignored. Here's my code Code: [Select] <HTML><body><form name="myform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <fieldset><label for="DBRIDs">RIDs</label><input type="text" id="DBRIDs" name="DBRIDs" > </fieldset></form></body></HTML> <?php function check_search() { if (isset($_POST['submit'])) {if (!empty($_POST['DBRIDs'])) { $results = getFiles(); } } else $errors = "Please enter something before you hit SUBMIT."; return Array($results, $errors); } function getFiles() { $result = null; $ZIPresult = null; if (empty($_POST['DBRIDs'])) { return null; } $mydir = MYDIR; $dir = opendir($mydir); $DBRIDs = $_POST['DBRIDs']; $getfilename = mysql_query("select filename from search_table where rid in (" . $DBRIDs . ")") or die(mysql_error()); while ($row = mysql_fetch_array($getfilename)) { $filename = $row['filename']; $result .= '<tr><td><a href="' . basename($mydir) . '/' . $filename . '" target="_blank">' . $filename . '</a></td></tr>'; $ZIPresult .= basename($mydir) . '/' . $filename; } if ($result) { $result = "<table><tbody><tr><td>Search Results.</td></tr> $result</table>"; shell_exec("zip -9 SearchResult.zip ". $ZIPresult ." > /dev/null "); } return $result; } The hyperlinks pointing to the file(s) are generated just fine. The ZIP file however only contains the first file listed in the results. How can I get the ZIP file to capture ALL the files returned?? Thanks for your input. **PS: The new ZipArchive() library/class is not available on our production environment so I chose to use the Unix utility ZIP instead.** First of all, here's what i want it to look:' I just want that the related image must align towards left, and its information is just in front of it. But, what my code does is place the image on above line, and the information on the link below. Here's how it looks with my code. I will be able to make the changes with the File Information. The PHP which is being used is: 1. To fetch if preview is available: Code: [Select] $pre = ''; if ($prew==0) { if ($ext == 'bmp') $pre = 'Impossible Preview <br>'; if ($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpg' or $ext == 'png' or $ext == 'JPG' or $ext == 'GIF' or $ext == 'PNG'or $ext == 'JPEG') $pre = '<img style="align:left;margin: 1px;" src="im.php?bab=1&id='.$file_info['id'].'" alt=""/>'; }2. To insert the preview image: Code: [Select] if($pre!=NULL) echo '<div class="block">'.$pre.'</div>'; 3. And finally the code to fetch file information: Code: [Select] echo '<div class="fileName"><a href="load.php?id='.$file_info[id].'"><font color="red">'.$file_info['name'].''.$extension.'</font></a>|'; if($ext =='txt') { echo '<a href="read.php?id='.$file_info['id'].'&id2='.$id.'"><font color="red">Read</font></a>';} echo $new_info.''; if(!empty($file_info['fastabout'])) echo str_replace("\n", '<br>',$file_info['fastabout']); echo '</div>'; echo '<tr><div class="t_block">'.$ico.'<a href="view.php?id='.$file_info[id].'"><strong>File Info</strong></a></div></tr></td>'; I just can't figure out what to insert with the code. I think it must be some table formatting (TR/TD), but because I'm a noob with PHP, I failed in all my attempts. Please, if anyone could help me out! Hi I have got a database table for logging in. One user will not log in even though the data is valid Code: [Select] $user = ValidateKey($_SESSION["Name"] , $_SESSION["PWD1"] , $_SESSION["PWD2"]); // User if($Error == 1 || $user == 0 || $user == -1) { // header('Location: index.php'); echo $Error . " , " . $user; // result is 0, caf9eba77c55ab5ae81a01c25d1987d3 exit; } All other user are OK! Strange Desmond. Hi All. New at this, form is working perfect, then added recapthca, now it only handles recaptcha and not the form. not sure where the error is
In the given code below I am getting this error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\samples\getcustomers.php on line 20 WHY? Code: [Select] <?php $value = $_GET["q"]; $con = mysql_connect('localhost', 'root', ''); //db_connect(); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("ajaxDb",$con); $sql = "SELECT * FROM 'cutomers' WHERE Name = '".$value."'"; // echo $sql; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>Name</th> <th>Address</th> <th>Country</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td>" . $row['Address'] . "</td>"; echo "<td>" . $row['Country'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Hi all, Newbie here, i am having a problem to get my images to show which are stored in mysql database as a mediumblob. I get id number to print in table ut am just getting empty square with red cross in where my image should be. Is my code incorrect or is it something else? Appreciate your help with this. I have included both of the pages codes i am using. Thanks Tony image2.php <?php include("common.php"); error_reporting(E_ALL); $link = mysql_connect(host,username,password) or die("Could not connect: " . mysql_error()); mysql_select_db(db) or die(mysql_error()); $sql = "SELECT id FROM photos"; $result = mysql_query("$sql") or die("Invalid query: " . mysql_error()); ?> <table border="1"><tr><td>id</td><td>image</td></tr> <?php while($row=mysql_fetch_assoc($result)){ print '<tr><td>'.$row['id'].'</td><td>'; print '<img src="image1.php?id='.$row['id'].'height="75" width="100"">'; } echo '</td></tr></table>' ?> image1.php <?php ob_start(); include("common.php"); mysql_connect(host,username,password) or die(mysql_error()); mysql_select_db(db) or die(mysql_error()); $query = mysql_query("SELECT imgage FROM photos WHERE id={$_GET['image_id']}"; $row = mysql_fetch_array($query); $content = $row['image']; header('Content-type: image/jpg'); echo $content; } ob_end_flush(); ?> |