Jump to content

designanddev

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by designanddev

  1. how would i check the if(isset($id)) in SQL query? $query = "SELECT b.message as bmsg, b.ID as bid, b.subject, b.post_on, c.ID, c.blog_id, c.message as mgs FROM blog as b LEFT JOIN comments as c ON b.ID = c.blog_id GROUP BY bmsg"; if(isset($id)){ $query .= "WHERE b.ID = '$id'"; }
  2. Hi i have this function below.... biut i keep geting this warning message Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean i get this message when i run the function and set it $id, im not sure if the isset in this query is actually workin could someone please help. Kind Regards function get_posts($id = null, $cat_id = null){ global $dbc; $posts = array(); $query = "SELECT b.message as bmsg, b.ID as bid, b.subject, b.post_on, c.ID, c.blog_id, c.message as mgs FROM blog as b LEFT JOIN comments as c ON b.ID = c.blog_id GROUP BY bmsg"; if(isset($id)){ $query .= "WHERE b.ID = '$id'"; } $query = mysqli_query($dbc ,$query); while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){ $posts[] = $row; } return $posts; }
  3. Ok, im new to php and trying to develop an app that allows me to upload image then resize them only on the output, i managed to save the image on the server in a folder, now i want to be able to display this images on the site in different sizes depending on what part of the site. like thumbnails and a bigger scale ect... so far i have this code $image_properties = getimagesize("uploads/orders.jpg"); $image_width = $image_properties[0]; $image_height = $image_properties[1]; $image_ratio = $image_width / $image_height; echo"<img src=\"$image_ratio\">"; here i trying to divide the image by half... i no im a long way off i thought this would work due to retrieving the image size properties then dividing it by half, then echoing it out in an image tag, haha.... eventually i would like to master this and be able to change the size by assigning numbers to variable, keeping the size proportions. help on this topic would be great, i serious need it breaking down, am i far off? Kind Regards
×
×
  • 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.