Jump to content

williamh69

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by williamh69

  1. Hi guys i am populating products from db, but the images does not showing sequentially, there are gaps between images ,,how i can fix this this is my code: <?php $query = "SELECT * FROM products"; $select_products = mysqli_query($connection, $query); while ($row = mysqli_fetch_assoc($select_products)){ $product_id = $row['product_id']; $product_title = $row['product_title']; $product_image = $row['product_image']; $product_description = $row['product_description']; $product_quantity = $row['product_quantity']; $product_price = $row['product_price']; $short_desc = $row['short_desc']; ?> <div class="col-sm-4 col-lg-4 col-md-4"> <div class="thumbnail"> <img src="./images/<?php echo $product_image ?>" width="478" height="1034" alt=""> <div class="caption"> <h4 class="pull-right">$<?php echo $product_price ?></h4> <h4><a href="#"><?php echo $product_title ?></a> </h4> <p><?php echo $product_description ?>.</p> </div> <div class="ratings"> <p class="pull-right">18 reviews</p> <p> <span class="glyphicon glyphicon-star"></span> <span class="glyphicon glyphicon-star"></span> <span class="glyphicon glyphicon-star"></span> <span class="glyphicon glyphicon-star"></span> <span class="glyphicon glyphicon-star-empty"></span> </p> </div> </div> </div> <?php } ?>
  2. Hi guys i have this error, Parse error: syntax error, unexpected end of file in C:\wamp64\www\nigthclub\videos.php on line 103 but i know is probably easy to solve but for some reason i dont see the error. please help me <?php session_start(); ?> <?php error_reporting (E_ALL ^ E_NOTICE); ?> <!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=iso-8859-1" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link href="tablefiestas.css" rel="stylesheet" type="text/css" /> <title>La Taverna de Juan</title> </head> <body> <div id="container"> <div id="header"> <!--MENU BAR--> <?php include("includes/db.php"); ?> </div> <!--VIDEOS--> <?php $query = ("SELECT * from videos"); $result = mysqli_query($connection,$query); $num_per_page =05; ?> <table border="1" width="100%"> <tr> <td>Video Id</td> <td>Titulo</td> <td>Video</td> </tr> <tr> <?php while ($row=mysqli_fetch_assoc($result)) { $videoid = $row['videoid']; $titulo = $row['titulo']; $url_video = $row['url_video']; ?> <td><?php echo $videoid ?></td> <td><?php echo $titulo ?></td> <td><?php echo $url_video ?></td> </tr> <?php}?> </table> <?php $query = "SELECT * from videos"; $pr_result = mysqli_query($connection,$query); $totalrecord = mysqli_num_rows($pr_result); echo $totalrecord; ?> <br> <div id="footer"> <!--FOOTER--> <?php include("includes/footer.inc.php"); ?> </div> </div> </body> </html>
  3. hi trying to make a grid of two columns , data from db using mysqli and php, but it does not work...can you guys help me thanks in advance <?php $limit=2; $count=0; echo"<table border='0' align='center' cellpadding='2' cellspacing='2' width='70%'>"; $query = "SELECT * FROM posts"; $select_all_categories_query = mysqli_query($connection, $query); while ($row = mysqli_fetch_assoc($select_all_categories_query)){ $post_image = $row['post_image']; $post_title = $row['post_title']; $post_content = $row['post_content']; $post_user = $row['post_user']; $post_date = $row['post_date']; if ($count < $limit) { if($count ==0) { echo"<tr>"; } echo"<div class='post-img'>"; echo"<div class='img'>"; echo"<img src='assets/img/blog/$post_image' alt='Blog'>"; echo"</div>"; echo"<div class='tag'>"; echo"<a href='#'><span class='icon'><i class='fas fa-tags'></i></span> Business</a>"; echo"</div>"; echo"</div>"; echo"<div class='cont'>"; echo"<h6><a href='blog-single.html'>$post_title</a></h6>"; echo"<p>$post_content</p>"; echo"<div class='info'>"; echo"<a href='#'><span class='author'><img src='assets/img/blog/4.png' alt='Post'></span>$post_user</a>"; echo"<a href='#' class='right'><span class='icon'><i class='fas fa-clock'></i></span> $post_date</a>"; echo"</div>"; echo"</div>"; }else { $count=0; echo"<div class='post-img'>"; echo"<div class='img'>"; echo"<img src='assets/img/blog/$post_image' alt='Blog'>"; echo"</div>"; echo"<div class='tag'>"; echo"<a href='#'><span class='icon'><i class='fas fa-tags'></i></span> Business</a>"; echo"</div>"; echo"</div>"; echo"<div class='cont'>"; echo"<h6><a href='blog-single.html'>$post_title</a></h6>"; echo"<p>$post_content</p>"; echo"<div class='info'>"; echo"<a href='#'><span class='author'><img src='assets/img/blog/4.png' alt='Post'></span>$post_user</a>"; echo"<a href='#' class='right'><span class='icon'><i class='fas fa-clock'></i></span> $post_date</a>"; echo"</div>"; echo"</div>"; } $count++; } echo"</tr></table>"; ?> this is the result i want this kind of result thank you
  4. Got it... my mistake.. calling wrong function syntax
  5. Hi guys I AM NEW TO PHP AND MYSQLI... TRYING TO CALL FUNCTION BUT I GOT ERROR CANT FIGURE OUT WITH IT IS, THANKS FOR HELP ME functions.php <?php function Updatepost(){ global $db; $query = "UPDATE posts SET title='Yo me quiero casar con gloria', body='Me gusta el 69' WHERE id=3"; $result = mysqli_query($db, $query); if(!$result){ echo mysqli_error($db); } else{ echo "updated row sucessfully"; } } ?> Index.php <?php include("includes/db.php"); include("functions/functions.php"); ?> <?php function Updatepost(); ?> ERROR Parse error: syntax error, unexpected ';', expecting '{' in C:\wamp64\www\gloria-blog\index.php on line 9 THANKS
  6. hi guys i cant edit my data... what is my error <?php // get value of id that sent from address bar $menu_id=$_GET['menu_id']; // Retrieve data from database $sql="SELECT * FROM menus WHERE menu_id='$menu_id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result) ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <form name="form1" method="post" action="update_ac.php"> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td> </td> <td colspan="3"><strong>Update data in mysql</strong> </td> </tr> <tr> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td align="center"><strong>Menu name</strong></td> </tr> <tr> <td> </td> <td align="center"> <input name="menu_name" type="text" id="menu_name" value="<? echo $rows['menu_name']; ?>"> </td> <td> </td> <td align="center"> <input type="submit" name="Submit" value="Submit"> </td> <td> </td> </tr> </table> </td> </form> </tr> </table> <?php // close connection mysql_close(); ?> error said:_ notice: Undefined index: menu_id in C:\wamp\www\sparklenshine2\admin\edit.inc.php on line 4 the tablet is: menu_id | menu_name
  7. i found this class to use it <?php class Cleaner { var $stopwords = array(" find ", " about ", " me ", " ever ", " each ", " update ", " delete ", " add ", " insert ", " where ", " i ", " a ", " my ");//you need to extend this big time. var $symbols = array('/','\\','\'','"',',','.','<','>','?',';',':','[',']','{','}','|','=','+', '-','_',')','(','*','&','^','%','$','#','@','!','~','`'); function parseString($string) { $string = ' '.$string.' '; $string = $this->removeStopwords($string); $string = $this->removeSymbols($string); return $string; } function removeStopwords($string) { for ($i = 0; $i < sizeof($this->stopwords); $i++) { $string = str_replace($this->stopwords[$i],' ',$string); } return trim($string); } function removeSymbols($string) { for ($i = 0; $i < sizeof($this->symbols); $i++) { $string = str_replace($this->symbols[$i],' ',$string); } return trim($string); } }
  8. no,,, look for the stop words in the text, echo them back, (so like this you can delete manually or using any function to erase it) before enter to database.
  9. Some search engines don't record extremely common words in order to save space or to speed up searches. These are known as "stop words."
  10. Hi guys, thank so much for all your help. I have this question: I have a two tables one is a content text, and the other one there are the stop words. I would like to match my content with those stop words and echo them, before submit to db. content stopwords content_id words content any suggestion thank you
  11. Hi guys... please review my website. I appreciate your comments. www.sparklenshinecs.com
  12. ok thank you very much, i really appreciate your help. thank you thank you
  13. thank you, i re-wrote the code....this is what i have now <?php $menu_id = $_GET['cat']; $sql = mysql_query("SELECT * from paginas WHERE menu_id=$menu_id"); if(mysql_num_rows($sql)>0) { while($row = mysql_fetch_array($sql)) { $title = $row['title']; $sub_title = $row['sub_title']; $content = $row['content']; $title_tag= str_replace(' . ',' | ',$row['title_tag']); $keywords= $row['keywords']; $description= $row['description']; echo "<title>$title_tag</title>"; echo"<meta name='keywords' content='$keywords'>"; echo"<meta name='description' content='$description'></br>"; } echo"<h1>$title</h1>"; echo"<h2>$sub_title</h2>"; echo"<p>$content</p>"; } else { echo "No results found!"; } ?> what you think?
  14. Hi guys, thank you for all your help i really appreciated. I have my website, www.sparklenshinecs.com, and i am trying to do a SEO on it. However when I run a seo report appears two different lines of code as follow http://www.sparklenshinecs.com/index.php?content=paginas&amp;cat=7 and http://www.sparklenshinecs.com/index.php?content=paginas&cat=7 if I run the first link it gives me the following error on the page: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/10/9601510/html/paginas.inc.php on line 7 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/10/9601510/html/paginas.inc.php on line 38 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/10/9601510/html/paginas.inc.php on line 56 and if I run the second link: it gives me the normal page. Someone can please explain me whats going on, and how I avoid those warnings.
  15. <?php $menu_id = $_GET['cat']; $query="SELECT * from paginas WHERE menu_id=$menu_id"; $result=mysql_query($query); while($row=mysql_fetch_array($result,MYSQL_ASSOC)) { $page_id = $row['page_id']; $title = $row['title']; $sub_title = $row['sub_title']; $content = $row['content']; echo "<h1>$title</h1>"; echo"<br>"; echo"<h2>$sub_title</h2>"; echo"<br>"; echo"<p>$content</p>"; } ?> here it is
  16. adam i used your code but gives me also the same result
  17. hi cyber i tried but t it gives me the same result
  18. hi guys i have this two db's menu paginas menu_id page_id name menu_id title content I populate the menu with the following code, which working fine. <?php function query($parent_id) { //function to run a query $query = mysql_query ( "SELECT * FROM menus" ); return $query; } function fetch_menu($query) { while ( $result = mysql_fetch_array ( $query ) ) { $menu_id = $result ['menu_id']; $menu_name = $result ['menu_name']; $menu_link = $result ['menu_link']; echo "<li class='has-sub '><a href='index.php?content=paginas&cat=$menu_id'><span>$menu_name</span></a>"; echo "</li>"; } } fetch_menu (query(0)); //call this function with 0 parent id ?> then I link every menu in my list with each page with this code, but appears the first entry in all the menus, I used the following code: <?php $menu_id = $_GET['cat']; $query="SELECT page_id, title, sub_title, content from paginas where menu_id=$page_id"; $result=mysql_query($query); while($row=mysql_fetch_array($result,MYSQL_ASSOC)) { $page_id = $row['page_id']; $title = $row['title']; $sub_title = $row['sub_title']; $content = $row['content']; echo "<h1>$title</h1>"; echo"<br>"; echo"<h2>$sub_title</h2>"; echo"<br>"; echo"<p>$content</p>"; } ?> what i am doing wrong..... thank you for ur help
  19. <?php function login() { $con = mysql_connect("localhost", "xxxx", "xxxx") or die('Could not connect to server'); mysql_select_db("xxxx", $con) or die('Could not connect to database'); } ?> this is the loging function.... from file called mylibrary
  20. hi guys i have the following db table called topnavigation id name url title this is the code to get the navigation from mysql <?php include("mylibrary/login.php"); $sql = mysql_query("SELECT * FROM topnavigation"); while($row = mysql_fetch_array($sql)){ $id = $row['id']; $name = $row['name']; $url = $row['url']; $title = $row['title']; echo"<li>"; echo"<a href='$url' title='$title'>$name</a>"; echo"</li>"; } ?> But i have this error: atal error: Cannot redeclare login() (previously declared in C:\wamp\www\sparklenshine\mylibrary\login.php:3) in C:\wamp\www\sparklenshine\mylibrary\login.php on line 7 thank your for help
  21. hi guys, i change all the code: <?php $dbhost = 'localhost'; $dbuser = 'whbweb'; $dbpass = 'andres69'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } if (!isset($page_id)) $page_id=1; $sql = 'SELECT keywords,title,description FROM meta_tags where id=$page_id'; mysql_select_db('whb'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_assoc($retval)) { $title= $row['title']; $keywords= $row['keywords']; $description= $row['description']; echo"<meta name='title' content='$title'>"; echo"<p>"; echo"<meta name='keywords' content='$keywords'>"; echo"<p>"; echo"<meta name='description' content='$description'></br>"; } mysql_close($conn); ?> Now I have the following error: Could not get data: Unknown column '$page_id' in 'where clause'
  22. hi guys, i have this database table called meta_tags id keywords description title and I have the following code to retrieve the data <?php $id = 1; $query=("SELECT title, keywords, description FROM meta_tags WHERE id =$id"); $result=mysql_query($query); while($row=mysql_fetch_array($result,MYSQL_ASSOC)) { $title= $row['title']; $keywords= $row['keywords']; $description= $row['description']; echo"<meta name='title' content='$title'>"; echo"<meta name='keywords' content='$keywords'>"; echo"<meta name='description' content='$description'>"; } ?> but I have this error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\WHB\includes\metags.inc.php on line 10 can you guys help me please.... thank you
×
×
  • 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.