Jump to content

Search the Community

Showing results for tags 'display'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 16 results

  1. I want to display 10 products from each category from database, I started to display the categories but how to make displaying the products from each one. Here is the code I make so far. I'm not sure am I doing it right with doble sql select , or it can be done only with one. <div class="inner shadow"> <?php $query = 'SELECT id, title_bg AS `title_cat` FROM categories'; $result = $this->db->query($query); ?> <?php foreach ($result->result() as $row): ?> <?php $title_cat = stripslashes($row->title_cat); ?> <div class="prod-sec"> <div class="prod-head"> <h2><?= $title_cat?></h2> <div class="clear"></div> </div> <?php $query1 = 'SELECT t1.id, t1.title_bg AS `Title`, t1.text_bg AS `Text`, t1.price, t1.discount, t1.category_id, t1.promo_page, t2.id AS FileID, t2.ext, FROM products t1 LEFT JOIN products_pictures t2 ON t1.id = t2.object_id LEFT JOIN categories t3 ON t3.id = t1.category_id WHERE t1.promo_page = 0 AND t1.is_active = 1 AND t3.title_bg = '$title_cat' ORDER BY RAND() LIMIT 10'; $result1 = $this->db->query($query1); ?> <div id="classeslist2"> <ul class="home_middle_products"> <?PHP foreach($result1->result() as $row1) { $f = 'files/products_first_page/' . $row1->id . '.jpg'; if(is_file(dirname(__FILE__) . '/../../' . $f)) { $img = site_url() . "files/products_first_page/".$row1->id.".jpg"; } else { $img = site_url() . "files/products/".$row1->id."/".$row1->FileID."_2.".$row1->ext; } $title = stripslashes($row1->Title); $text = character_limiter(strip_tags(stripslashes($row1->Text)),250); $title_url = getLinkTitle($title); $link = site_url()."products/product/".$row1->id."/{$title_url}"; ?> <li style="width: 185px; height: 270px; margin-left: 3px; margin-top: 10px;"> <div class="thumb"> <a href="<?=$link?>"><img src="<?=$img?>" alt="<?=$title?>" width="182" /></a> <div class="price"><?PHP echo product_price($row1, array('show_discount' => false,"show_old_price"=>false, 'show_label' => false, 'view' => 'no')); ?> </div> </div> <h2></h2> <h2><a href="<?=$link?>"><?=$title?></a></h2> <? $text = substr($text, 0, 100); ?> <? if (strlen($text) == 100) $text .= '...' ; ?> <p><?=$text?></p> </li> <?php } ?> <div class="clear"></div> </ul> </div> </div> <?php endforeach; ?> <div class="clear"></div> </div>
  2. Hi guys, I've a little problem i have a fileld in my database that i want to check. If is null to display some text else display another text. I've manage to do something like this but doesn't work. The code is below: <?php $result = @$mysqli->query("SELECT * FROM depanarecuora_clients WHERE paid_status = '$paid_status'"); while ($result = mysqli_fetch_assoc($result)) if (is_null($paid_status)) { echo "some text"; } ?>
  3. All I am trying to do is add a record on a page without the page refreshing. For that ajax is used. Here is the code. It does not add the record to mysql table. Can anyone tell me what I am doing wrong? record.php <!DOCTYPE HTML> <html lang="en"> <head> <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script> <script type="text/javascript" > $(function() { $(".submit_button").click(function() { var textcontent = $("#content").val(); var name = $("#name").val(); var dataString = 'content='+ textcontent + '&name='+name; if(textcontent=='') { alert("Enter some text.."); $("#content").focus(); } else { $("#flash").show(); $("#flash").fadeIn(400).html('<span class="load">Loading..</span>'); $.ajax({ type: "POST", url: "action.php", data: dataString, cache: true, success: function(html){ $("#show").after(html); document.getElementById('content').value=''; $("#flash").hide(); $("#content").focus(); } }); } return false; }); }); </script> </head> <body> <?php $record_id = $_GET['id']; // getting ID of current page record ?> <form action="" method="post" enctype="multipart/form-data"> <div class="field"> <label for="title">Name *</label> <input type="text" name="name" id="name" value="" maxlength="20" placeholder="Your name"> </div> <div class="field"> <label for="content">content *</label> <textarea id="content" name="content" maxlength="500" placeholder="Details..."></textarea> </div> <input type="submit" name="submit" value="submit" class="submit_button"> </form> <div id="flash"></div> <div id="show"></div> </body> </html> action.php if(isset($_POST['submit'])) { if(empty($_POST['name']) || empty($_POST['content'])) { $error = 'Please fill in the required fields!'; } else { try { $name = trim($_POST['name']); $content = trim($_POST['content']); $stmt = $db->prepare("INSERT INTO records(record_id, name, content) VALUES(:recordid, :name, :content"); $stmt->execute(array( 'recordid' => $record_id, 'name' => $name, 'content' => $content )); if(!$stmt){ $error = 'Please fill in the required fields.'; } else { $success = 'Your post has been submitted.'; } } catch(Exception $e) { die($e->getMessage()); } } }
  4. So I've followed this code, corrected about 12 error, talked to my hosting and I am so done. I have tried everything but the error won't go away. The code is pasted below. As it's really late any help would be appreciated that would make my day the next day... <?PHP //connect to server $connect = mysql_connect("localhost","cello10_import","brigite27"); //connection to database mysql_select_db("cello10_import"); //query the database $query = mysql_query("SELECT * FROM users WHERE cover_image = 'http://d1w7fb2mkkr3kw.cloudfront.net/assets/images/book/small/9781/2500/9781250038821.jpg' "); //fetch the results / convert into array WHILE($rows = mysql_fetch_array(query)): $cover_image = $rows['cover_image']; $title = $rows['title']; $author = $rows['author']; echo "$cover_image<br>$title<br>$author<br><br><br>"; endwhile; ?> The error experienced is: Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/cello10/public_html/display.php on line 10 Thanks for your help
  5. How to display items like bottom table? And here is the code <? print" <table style=\"width:100%\" class=\"tableList\"> <tr> <th style=\"width:35%\">Prize Name</th> <th style=\"width:12%\">Amount</th> <th style=\"width:12%\">Points</th> <th style=\"width:12%\">Available</th> <th style=\"width:12%\">Redeemed</th> <th style=\"width:17%\">Action</th> </tr>"; $giftCardQuery = 'SELECT currency, amount, pointsPrice, instant_gift_cards.id, instant_gift_cards.giftCardName, instant_gift_cards.giftCardImage FROM instant_gift_card_codes INNER JOIN instant_gift_cards ON (instant_gift_card_codes.giftCardId = instant_gift_cards.id) WHERE instant_gift_cards.status = :cardStatus ORDER BY instant_gift_cards.dateCreated DESC'; $giftCard = $db->prepare($giftCardQuery); $giftCard->bindValue(':cardStatus', 'Enabled', PDO::PARAM_STR); $giftCard->execute(); if($giftCard->rowCount() > '0'){ while($giftCardRow = $giftCard->fetch(PDO::FETCH_ASSOC)){ $giftCardsAvailableQuery = 'SELECT count(*) FROM instant_gift_card_codes WHERE currency = :currency AND amount = :amount AND pointsPrice = :pointsPrice AND giftCardId = :id AND status = :status'; $giftCardsAvailable = $db->prepare($giftCardsAvailableQuery); $giftCardsAvailable->bindParam(':currency', $giftCardRow['currency'], PDO::PARAM_STR); $giftCardsAvailable->bindParam(':amount', $giftCardRow['amount'], PDO::PARAM_STR); $giftCardsAvailable->bindParam(':pointsPrice', $giftCardRow['pointsPrice'], PDO::PARAM_STR); $giftCardsAvailable->bindParam(':id', $giftCardRow['id'], PDO::PARAM_INT); $giftCardsAvailable->bindValue(':status', 'Available', PDO::PARAM_STR); $giftCardsAvailable->execute(); $gCardsAvailable = $giftCardsAvailable->fetch(PDO::FETCH_COLUMN); $giftCardsRedeemedQuery = 'SELECT count(*) FROM instant_gift_card_codes WHERE currency = :currency AND amount = :amount AND pointsPrice = :pointsPrice AND giftCardId = :id AND status = :status'; $giftCardsRedeemed = $db->prepare($giftCardsRedeemedQuery); $giftCardsRedeemed->bindParam(':currency', $giftCardRow['currency'], PDO::PARAM_STR); $giftCardsRedeemed->bindParam(':amount', $giftCardRow['amount'], PDO::PARAM_STR); $giftCardsRedeemed->bindParam(':pointsPrice', $giftCardRow['pointsPrice'], PDO::PARAM_STR); $giftCardsRedeemed->bindParam(':id', $giftCardRow['id'], PDO::PARAM_INT); $giftCardsRedeemed->bindValue(':status', 'Redeemed', PDO::PARAM_STR); $giftCardsRedeemed->execute(); $gCardsRedeemed = $giftCardsRedeemed->fetch(PDO::FETCH_COLUMN); if($giftCardRow['giftCardImage']){ $nameOrImage = '<img src="./images/giftcardrewards/'.$giftCardRow['giftCardImage'].'" alt="'.$giftCardRow['giftCardName'].'" title="'.$giftCardRow['giftCardName'].'">'; }else{ $nameOrImage = $giftCardRow['giftCardName']; } if($gCardsAvailable == '0'){ $redeemAction = 'Out of Stock'; } elseif($userInfo['currentPoints'] < $giftCardRow['pointsPrice']){ $needed = $giftCardRow['pointsPrice'] - $userInfo['currentPoints']; $redeemAction = 'You need '.$needed.' point(s)'; } elseif($userInfo['currentPoints'] >= $giftCardRow['pointsPrice']){ $redeemAction = '<input type="button" value="Redeem" onclick="if(confirm(\'Are you sure to redeem this prize?\')){location.href=\'index.php?do=instantGiftCards&action=redeem&cardId='.$giftCardRow['id'].'&amount='.$giftCardRow['amount'].'\';}">'; } print" <tr> <td>".$nameOrImage."</td> <td style=\"text-align:center\">".$giftCardRow['currency'].$giftCardRow['amount']."</td> <td style=\"text-align:center\">".$giftCardRow['pointsPrice']."</td> <td style=\"text-align:center\">".$gCardsAvailable."</td> <td style=\"text-align:center\">".$gCardsRedeemed."</td> <td style=\"text-align:center\">".$redeemAction."</td> </tr>"; } }else{ print" <tr> <td colspan=\"4\" style=\"text-align:center;color:#2B1B17;padding:15px 0\">No prizes added.</td> </tr>"; } print" </table>"; ?>
  6. Hi. I have a problem where when i try to display the uploaded JPEG file, the browser would only dispay the placeholder for an image . I think the problem is within the 3rd IF statement. Please help me thanks. <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { if(isset($_FILES['photo']) && is_uploaded_file($_FILES['photo']['tmp_name']) && $_FILES['photo']['error']==UPLOAD_ERR_OK) { if($_FILES['photo']['type']=='image/jpeg') { echo 'asdsad'; $tmp_img = $_FILES['photo']['tmp_name']; $image = imagecreatefromjpeg($tmp_img); header('Content-Type: image/jpeg'); imagejpeg($image, NULL, 90); imagedestroy($image); } else { echo "Uploaded file was not a JPG image."; } } else { echo "No photo uploaded!"; }} else { echo " <form action='test.php' method='post' enctype='multipart/form-data'> <label for='photo'>User Photo:</label> <input type='file' name='photo' /> <input type='submit' value='Upload a Photo' /> </form> ";} ?>
  7. So I have a user profile setup where it's linked unique username using $_GET session. That all works. Now here's a bit that I didn't think of. I can't display the same profile that I view to other users; because then the content on the profile page would be relavent to the person logged in. For eg. $get_username = $_GET['user']; if($username === $get_username) { $stmt = $dbh->prepare("SELECT * FROM users WHERE user_id = $userid"); //display user's profile to himself only. } else { //display user's profile to everyone else } My set is like that. The problem with that is, I can't get the same content to show on the the profile that's viewed by other users; because I'm using current logged in user's id to get records from mysql db.
  8. Hi Guys, I'm wondering if anyone knows how to design a users display page or can lead me to a tutorial on how to design a users display page that outputs the users in thumbnail form... So like for instance..... SELECT * FROM users WHERE state = Victoria; and then showing all the users that are from the State of Victoria in, say, 108px by 108px thumbnails .... eight thumbnails wide, with their username showing up in a separate label when you hover over the thumbnails .... I'll clarify it further if need be, but I've managed to mock it up in HTML and Javascript, I've just forgotten how to get it done using PHP. (I have the users my database already, just waiting there) Any help would be much appreciated! Cheers
  9. Hello people! Yes, I'm here again for a serious mattter. I've been trying to display a value from the table I've created in my database, it's teacher profiling system which functions enables the user to ADD, UPDATE, and VIEW the teacher's profile. So first let me introduce my novice codes... First, I let the user to insert data into table with this- <form method=post action=process_add_tchr_profile.php> <p align="left"><input type=number name=tchr_id placeholder="Teacher ID" required></p> <p><input type=text name=tchr_lname placeholder="Last Name" required> <p><input type=submit value=Submit><input type=reset value=Reset></p> </form> Second, after submission it will be processed and stored in- $connection = mysql_connect("localhost", "root", ""); $db = mysql_select_db("snnhs_db", $connection); $sql="INSERT INTO snnhs_db.tbl_tchr_profl( `tchr_id`, `tchr_lname`,) VALUES ('".$_POST["tchr_id"]."', '".$_POST["tchr_lname"]."',)"; $result = mysql_query($sql); Third, in my html, I put an action where user can update the profile of the teacher- $dbconnect = mysql_connect("localhost","root",""); mysql_select_db("snnhs_db",$dbconnect); $sql = "SELECT * FROM tbl_tchr_profl"; $result = mysql_query($sql); $ctr = 0; while($row = mysql_fetch_array($result,MYSQL_NUM)){ for($x=0;$x<count($row);$x++){ $tchr_profl[$ctr][$x] = $row[$x]; } $ctr++; } <h3>List of Accounts</h3> <a href=#>Add New Account</a> <table border=1 cellpadding=5> <tr> <th>No</th> <th>Teacher ID</th> <th>Last Name</th> <th>Action</th> </tr> <?php $ctr = 1; for($x=0;$x<count($tchr_profl);$x++){ echo "<tr>"; echo "<td>".$ctr++."</td>"; echo "<td>".$tchr_profl[$x][0]."</td>"; echo "<td>".$tchr_profl[$x][1]."</td>"; echo "<td><a href=update_tchr_profl.php?id={$tchr_profl[$x][0]}>UPDATE</td>" } Fourth, after clicking the UPDATE it will be redirected to update_tchr_profl.php where I have this code- <?php $dbconnect = mysql_connect("localhost","root",""); mysql_select_db("snnhs_db",$dbconnect); $sql = "SELECT * FROM tbl_tchr_profl WHERE tchr_id ={$_GET["id"]}"; $result = mysql_query($sql); $ctr = 0; while($row = mysql_fetch_array($result,MYSQL_NUM)){ for($x=0;$x<count($row);$x++){ $tchr_profl[$ctr][$x] = $row[$x]; } $ctr++; ?> <p align="left">"<?php ".$_POST["tchr_id"]."?>"</p> -- here I want to display the ID since it can't be updated. <p><input type=text name=tchr_lname value=<?php '".$_POST["tchr_lname"]."' ?> required> -- here I want to display the current data of the last name from the first time it registers to the system This is my problem, I don't if it's possible or what. I've searched through the internet but I don't seem to understand much about what they're saying so I decided to post my codes for me to better understands it. Sorry about codes and if you ask me who teach me why did I came up with such code, well, it's just what I thought to be, because I thought it would work.
  10. i am trying to develop a registration form where the user fill the form and submit it then the status and the id should be displayed. i have used uniq_id function to generate a random id and with the help of this reference id i can retrieve the actual ID and display it back to the user. But unfortunately i am successful with the first registration after the first registration it throws an error that Error: "Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 9". my code: <?php include(conn.php); $id = $_GET['id']; $adv = $_GET['adv']; $name = $_GET['name']; $address = $_GET['address']; $pincode = $_GET['pincode']; $email = $_GET['email']; $fax = $_GET['fax']; $mobile = $_GET['mobile']; $amount = $_GET['amount']; $ddchno = $_GET['ddchno']; $bank = $_GET['bank']; $register = mysql_query( "insert into exbadv ( refid,adv,name,address,pincode,email,fax,mobile,amount,ddchno,bank) values ('$id','$adv','$name','$address','$pincode','$email','$fax','$mobile','$amount','$ddchno','$bank')"); $id = $_GET['id']; $result = mysql_query("SELECT id FROM exbadv WHERE refid = '$id'"); echo 'Your Registration id is ';echo mysql_result($result,0); ?> Plz help me out,thank u.
  11. Hi all, I've a problem with my PHP code. I've a page, where you can select multiple pages, which will be displayed at the related section on my site. So far, you can select the pages, and they will be injected into the database, and they will be displayed on the site. My only problem is: the pages won't be selected on the edit page. I've this piece of code, and I don't know what I'm doing wrong. <?php $id = $_POST["id"]; $sql=mysql_query("SELECT `title`,`url`,`volg`, `headerpicture`, `picture`, `product_id` FROM `pagina` WHERE `id`='".$id."' LIMIT 0,1"); $row=mysql_fetch_assoc($sql); echo '<select MULTIPLE name="related[]">'; if ($row['related'] != '') $related_array=explode(',',$row['related']); else $related_array=array(); $query="SELECT `id` FROM `producten`"; $sql=mysql_query($query) or die(mysql_error()); while($line=mysql_fetch_array($sql)) { $query1="SELECT `title` FROM `pagina` WHERE `product`=1 AND `product_id`='".$line['id']."'"; $sql1=mysql_query($query1); if(mysql_num_rows($sql1) >0) { $line1=mysql_fetch_array($sql1); $selected=' '; foreach($related_array as $related_line) { if ($related_line == $line['id']) $selected=' selected '; } echo '<option'.$selected.'value="'.$line['id'].'">'.$line1['title'].'</option>'; } } echo '</select>'; ?> What am I doing wrong? Is there a piece of code I need to script?
  12. Hey guys! I am trying to achieve the following functionality; Use javascript to display page content that is stored on one page by showing the requested content through the navigation, i.e. clicking the Home link, and making the previous page content invisible. I have been playing around with altering the CSS styling off the div's. I have 3 div's each name; Home, Portfolio and Enquire. Here is the CSS for them; #home { display: block; } #portfolio { display: none; } #enquire { display: none; } So from this the home div is the first that is seen when the page loads. Now using the navigation I have I am calling a function; <nav class="row"> <ul> <li class="above-border"> </li> <li class="nav-smallfont">about</li> <li><a href="javascript:toggle_visibility('portfolio');" alt="Portfolio" target="_self">PORTFOLIO</a></li> <li class="above-border"> </li> <li class="nav-smallfont">back</li> <li><a href="javascript:toggle_visibility('home');" alt="Homepage" target="_self">HOME</a></li> <li class="above-border"> </li> <li class="nav-smallfont">furniture</li> <li><a href="#" onclick="toggle_visibility('enquire');" alt="Enquire" target="_self">ENQUIRE</a></li> <li class="above-border"> </li> </ul> </nav> I was playing around with the difference between onclick and javascript: - I didnt really see any major difference. Now my Javascript is this; <script type="text/javascript"> function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block'){ e.style.display = 'none'; } else{ e.style.display = 'block'; } } </script> Now whenever I click on the home navigation it will show/hide the content and when I click on say, the portfolio link it will show this content as well as the home. Im pretty sure you understand what I am hoping to achieve; A navigation style functionality so that when the portfolio link is click, it hides the other content and show only that and visa versa for the other links. Thanks for your help! Sam
  13. Hello, I'm trying to display the results of my query in a text box so that they can be edited, if need be, and updated in the database. I'm getting the error below, with the code below. I've tried a couple of different ways to format the "value" of the text box as you can see by the second one that's commented out and still a no go. Thanks for any help in advance guys. The error below is referring to the code just below here. echo "<td><input type="text" name="firstname" value="$firstname"></td>"; Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\ $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo "<table><tr>"; echo "<th>First Name</th>"; echo "<th>Middle Initial</th>"; echo "<th>Last Name</th>"; echo "<th>Full Name</th>"; echo "<th>Provider ID</th></tr>"; while (odbc_fetch_row($rs)) { $firstname=odbc_result($rs,"provider_first_name"); $middleinitial=odbc_result($rs,"provider_middle_name"); $lastname=odbc_result($rs,"provider_last_name"); $fullname=odbc_result($rs,"provider_full_name"); $provider_id=odbc_result($rs,"provider_id"); echo "<tr><td>$firstname</td>"; echo "<td><input type="text" name="firstname" value="$firstname"></td>"; echo "<td>$middleinitial</td>"; echo "<td>$lastname</td>"; echo "<td>$fullname</td>"; echo "<td>$provider_id</td>"; // echo "<td><input type="text" name="textfield" value='".$providerid."'"></td>"; echo "<td>$providerid</td></tr>"; } odbc_close($conn);
  14. I'm working with a client and setting up this form for them. I'm trying to have the user be able to add a new name and email record into the account table. Once they submit it should display the 10 newest records below the form. Appreciate any help. class account{ function account(){ $this->id = ' '; $this->name = ''; $this->email = ''; } function find_account($id){ $sql="select `id` from `account` where `id`='".$id."'"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)){ $row['id']; //int pk auto incerment $row['name']; //varchar(50) $row['email']; //varchar(50) $row['timestamp']; //varchar(15) } } } <html> <body> <div> <form action='#'> name: <input type='text' name='account_name'> email:<input type='text' id='account_email'> <input type="button" value="submit"> </form> </div> <div style="border:solid 1px #F60;"> Last 10 entry: </div> <div style="border:solid 1px #000;"> <?php echo "id: ".$account->id;?> <?php echo "name: ".$account->name;?> <?php echo "email: ".$account->email;?> </div> </body> </html>
  15. Hey guys i've got a rookie question. How do i shuffle an array then display each number in the array using implode? Heres my code. $maximum_integer = strip_tags(trim($_REQUEST['maximum_integer'])); $range = range(0,$maximum_integer); $range_randomized[] = shuffle($range); $random_range_imploded = implode(', ', $range_randomized); print $random_range_imploded; it just keeps displaying '1'.... Thanks!
  16. Every month I have pdf file with 40 pages, and I upload file to folder on webserver. Every user on internal company website have his own page in that pdf file. How to display specific page to specific user, without manual embedding to user profile page? Or display it on designated page for that pdf file, but with selection for user to pick his own page from pdf? Better option would be that user can navigate whole archive of pdf and pick year, month and his page from pdf. User's page in pdf has always same page number and his own phone number becouse pdf is phone bill for company mobile phones.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.