jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
An intranet or a home network connection should be Ok.
-
T_variable parse error - mysqli prepared statement
jazzman1 replied to wright67uk's topic in PHP Coding Help
Sounds like, you may be run into a different file. What happens if you comment all lines of the script. Something like: <?php /*session_start(); $user_id = $_SESSION["user"]["user_id"]; $user_level = $_SESSION["user"]["user_level"]; include 'connect.php'; $outcome = $_GET['outcome']; $id = $_GET['id']; $blank = " "; $placed = $_GET['outcome']; if (isset($placed)) { $stmt = $mysqli->prepare("UPDATE toptips SET placed = ? WHERE id = ? "); $stmt->bind_param('si', $placed, $id); //stops here $stmt->execute(); $stmt->close(); } * */ -
First thing you should have to learn is, what a server is and what a server does. Try to "Google it".
-
Every column or table name should be enclosed with back ticks (if you want it) and every value with single quotes except the values with type of integer! So, that is totally wrong: $sql = "SELECT 'upload_id','file_name', 'file_size', 'file_type' FROM 'uploads' WHERE upload_id = $uid";
-
If the images (files) are stored in the filesystem is easy. Try that (tested many times) <?php // just so you know it is broken error_reporting(-1); if (!empty($_GET['uid'])) { $uid = intval($_GET['uid']); $sql = "SELECT 'upload_id','file_name', 'file_size', 'file_type' FROM 'uploads' WHERE upload_id = $uid"; // the result of the query $result = mysql_query($sql) or die("Invalid query: " . mysql_error()); $row = mysql_fetch_assoc($result) or die(mysql_error()); $the_file = '/uploads'.'/'.$row['file_name']; // dump this result to be sure that everything is fine header('Content-Description: File Transfer'); header("Content-type: " . $row['file_type']); header('Content-Disposition: attachment; filename=' . basename($the_file)); header('Content-Length: ' . filesize($the_file)); readfile($the_file); mysql_close($link); //close connection } PS: The header('Content-Length: ' . filesize($the_file)) you could replace with - header('Content-Length: ' . $row['file_size']); You have an error here - FROM 'uploads'
-
how to redirect all urls of the main domain to a subfolder ?
jazzman1 replied to sasori's topic in Apache HTTP Server
I really like that So according your topic: www.mydomain.com -> will be redirected to -> www.mydomain.com/myfolder www.mydomain.com/blahblahbalh -> will be redirected to -> www.mydomain.com/myfolder dev.mydomain.com/omghowtodothis ->will be redirected to -> www.mydomain.com/myfolder So can you be more specific, please? Or....which part of the code doesn't work? Thank you for the link above -
Wrong pattern!
- 45 replies
-
- apache
- mod_rewrite
-
(and 1 more)
Tagged with:
-
how to redirect all urls of the main domain to a subfolder ?
jazzman1 replied to sasori's topic in Apache HTTP Server
This will redirect every directory request which not contains a file itself. For instance /folder1, /folder2 but not /folder1.display.php Try, Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ /myfolder [QSA,L,R=307] By the way, do you know any good online resource where I can watch "Naruto" with good quality? -
Agreed! Store all images in the filesystem and let the pain go away
-
Um....that solution doesn't work for me! Check if the file size is correct. I still think you should have to use Content-Length, but gives me an error if the file comes from a database as binary string. I will play around that later on because this is interesting topic for me
-
So, the best solution for me is, when you get a data (binary file) from a database to save it on the real server, then zip(compress) the file and attach it to email. I am working right now, but I will try to provide you a solution later on.
-
No, there is something wrong when the image comes from the database. I should make some tests.
-
Then, it should be something like that: $a = mysql_fetch_assoc($q); header('Content-Description: File Transfer'); header("Content-type: ".$a['type']); header('Content-Disposition: attachment; filename='. basename($a['name'])); header('Content-Length: ' . filesize($a['length'])); readfile($a['data']); Be careful about " header('Content-Length: ' . filesize($a['length']));" if you don't have information about the length of the file in your database, you can use the sql length function to grab the size of this binary file. So, the query string should similar like: $sql = "SELECT `data`, `name`, `type`, length(`data`) as length FROM `db_name`.`tbl_name` WHERE image_id=".$_GET['image_id'];
-
Where did you save the images on the server or database? And why, are you using base64 if the images are saved on the server?
-
Create a new empty array, for instance $count_pax_number and put inside it every value of $pax_number, then print out that total after the loop has stopped. Take a look at my example above and use the same logic.
-
Here is a brief example how it works: $count = array(); $i = 0; while ($i < 10) { $count[] = $i; $i++; } // print out the results echo '<pre>'.print_r($count, true).'</pre>'; echo count($count); In your example let the $pax_number to be an array and count all results.
-
This will match only letters inside a character class closing with brackets ([ ]), between "=" and "&" symbols. $url = '<a href="/cashback.aspx?linkauth=MATCHEVERYTHINGHERE&mpurl=test&usr=test">'; if(preg_match('~=([A-Za-z]+)&~', $url, $match)) { echo '<pre>'.print_r($match[1], true).'</pre>'; } else { echo 'No match'; } Or.....everything between these two symbols: $url = '<a href="/cashback.aspx?linkauth=MATCHEVERYTHINGHERE&mpurl=test&usr=test">'; if(preg_match_all('~=([A-Za-z]+)&?~', $url, $match)) { echo '<pre>'.print_r($match[1], true).'</pre>'; } else { echo 'No match'; }
-
It's a different source code in comparison with previous one. All js code should be inside HTML tags (just to mention) and works fine for me.
-
As a result of using the template engine, you were include the same js-library code twice on your templates. The HTML source output should be similar like that: <!-- saved from url=(0041)http://localhost/corearch2/catalogues.php --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="http://code.jquery.com/jquery-1.10.1.min.js"></script><style type="text/css"></style> <script> $(document).ready(function(){ // ---------------------------------------------------------------------------------------------------------------------------------- // Things to do after page loads var search_watermark = 'Search here'; $('#search').val(search_watermark).addClass('watermark'); // Add the search water mark to the search field. $("#fld_notes").hide(); // Hide the notes text area. // ---------------------------------------------------------------------------------------------------------------------------------- $('#new').click( function() { // $(".message").hide(); $('.message').text("New Catalogue"); $('#category_id').val("Please Select"); //reset showDialog(); checkCategory(); }); $('#category_id').change( function() { checkCategory(); // checks value and enables/disables subcategory control console.log(true); return false; var catid = $(this).val(); var dataString = 'catid='+catid; $.ajax ({ type: "POST", url: "catalogues.php", data: dataString, cache: false, success: function(data) { $('#subcategory_id').html(data).focus(); } }); }); $('#close').click( function() { hideDialog(); }); $("#notes_sh").click(function(){ // Notes show and hide toggle, off by default, $("#fld_notes").toggle(); }); $("#save").click(function(){ // Notes show and hide toggle, off by default, // So some save activity here $(".message").show().addClass("message_success", "message").text("Record saved successfully."); setTimeout(function() { $('.message').removeClass("message_success").text("Saved record title and file code goes here."); }, 5000); }); // ---------------------------------------------------------------------------------------------------------------------------------- // JS functions function hideDialog() { // Hide the dialog $('#dialog').fadeOut("slow"); $('#dialog_wrapper').fadeOut("slow"); } function showDialog() { // Show the dialog $('#dialog_wrapper').fadeIn(); $('#dialog').fadeIn("slow"); } // If category was changed adjust select boxes to suit. If category equals 'Please Select', sub-category should be disabled and set to 'Please Select' function checkCategory() { if ($('#category_id').val() == 'Please Select') { $('#subcategory').hide(); } else { $('#subcategory').show(); } } }); </script> <title>Catalogues</title> <link href="./Catalogues_files/layout.css" type="text/css" rel="stylesheet"> <link href="./Catalogues_files/default.css" type="text/css" rel="stylesheet"> </head> <body style=""> <div class="wrapper"> <div id="dialog_wrapper" style="display: none;"> </div> <div id="dialog" style="display: block"> <div class="dialog_form"> <div class="message">New Catalogue</div> <div style="float: left"> <div class="field"><label>Title:</label><input class="field" id="title" name="title" type="text" value=""></div> <div class="field"><label>Manufacturer:</label> <select class="required" id="manufacturer" name="manufacturer"> <option>Please Select </option> <option value="444"> TEKFORM - Duropal </option> <option value="762"> 3Form </option> <option value="372"> 3M Scotchshield </option> <option value="812"> 3S Lighting </option> <option value="527"> A Sign Design </option> <option value="641"> A1 Rubber </option> <option value="261"> AAF Australian Aluminium Finishing </option> <option value="456"> Abax Systems </option> <option value="474"> Abbott's Office Furniture </option> <option value="33"> Abet </option> </select> </div> <div class="field"><label>File Code:</label><input class="field" type="text" name="file_code" value=""></div> <div class="field"><label>Catalogue URL:</label><input class="field" type="text" name="website" value=""></div> </div> <div style="float: right"> <div class="field"><label>Media:</label> <select class="required" id="media_id" name="media_id"> <option>Please Select </option> <option value="3"> CD/DVD </option> <option value="1"> Folder </option> <option value="2"> Leaflett/Brochure </option> <option value="4"> Sample </option> </select> </div> <div class="field"><label>Category:</label> <select class="required" name="category_id" id="category_id"> <option>Please Select </option> <option value="1"> Building Systems</option> <option value="17"> Completetion of structure</option> <option value="21"> External works</option> <option value="23"> Finishes</option> <option value="20"> Fittings</option> <option value="22"> General products, building materials</option> <option value="19"> Services - electrical</option> <option value="18"> Services - mechanical</option> <option value="24"> Special activities, requirements</option> <option value="3"> Structure</option> <option value="2"> Sub-Structure</option> </select> </div> <div class="field" id="subcategory" style="display: block;"><label>Sub-category:</label> <select class="required" name="subcategory_id" id="subcategory_id"> <option value="-1"> Please Select </option><option value="33">Access Floors</option><option value="34">Balustrades</option><option value="29">Doors: general</option><option value="28">Doors: industrial</option><option value="30">Doors: parts, accessories</option><option value="25">External & entrance screens</option><option value="31">Lintels, sills, weather bars, other</option><option value="36">Rooflights</option><option value="32">Room dividers, internal grilles etc.</option><option value="35">Suspended ceilings</option><option value="26">Windows</option><option value="27">Windows: parts, accessories</option><br> <font size="1"><table class="xdebug-error xe-fatal-error" dir="ltr" border="1" cellspacing="0" cellpadding="1"> <tbody><tr><th align="left" bgcolor="#f57900" colspan="5"><span style="background-color: #cc0000; color: #fce94f; font-size: x-large;">( ! )</span> Fatal error: Call to a member function query() on a non-object in C:\Users\james.bh\Insync\www\corearch2\catalogues.php on line <i>243</i></th></tr> <tr><th align="left" bgcolor="#e9b96e" colspan="5">Call Stack</th></tr> <tr><th align="center" bgcolor="#eeeeec">#</th><th align="left" bgcolor="#eeeeec">Time</th><th align="left" bgcolor="#eeeeec">Memory</th><th align="left" bgcolor="#eeeeec">Function</th><th align="left" bgcolor="#eeeeec">Location</th></tr> <tr><td bgcolor="#eeeeec" align="center">1</td><td bgcolor="#eeeeec" align="center">0.0016</td><td bgcolor="#eeeeec" align="right">280352</td><td bgcolor="#eeeeec">{main}( )</td><td title="C:\Users\james.bh\Insync\www\corearch2\catalogues.php" bgcolor="#eeeeec">..\catalogues.php<b>:</b>0</td></tr> </tbody></table></font> </select> </div> </div> <div style="clear:both;"><br> <label>Notes:</label> <label id="notes_sh">Show/Hide</label><br> <textarea id="fld_notes" name="notes" rows="10" cols="128" style="display: none;"> </textarea><br> <label>Keywords:</label><br> <input style="width:100%;" type="text" name="keywords" value=""> </div> <div style="text-align: right ; margin-top: 20px; clear:both;"> Multiple <input type="checkbox" name="multiple"> <input type="hidden" name="id" value=""> <input class="Button" id="save" type="submit" value="Save" name="save"> <input id="close" class="button" type="button" value="close" name="close"> </div> </div> </div> <div id="header"> <div class="content"> </div> </div> <div id="menu"> </div> <div id="toolbar"> <div class="content" style="padding: 20px;"> <div style="float: left"> <input id="new" class="button" name="new" value="New Catalogue" type="button"> </div> <div style="float: right"> <span> 10 Records</span> <input id="search" class="search watermark" type="text" name="search" value=""> <input class="button" type="submit" value="Search" name="btnSearch"> </div> </div> <!-- end toolbar content div --> </div> <div id="body"> <div class="content"> <table class="grid"> <tbody><tr class="grid"> <!-- <th class='grid_th'></th>--> <th class="grid">Catalogue</th> <th class="grid">Manufacturer</th> <th class="grid">Category</th> <th class="grid">Sub-Category</th> <th class="grid">Office</th> <th class="grid">Media</th> <th class="grid">File</th> <th class="grid" width="75px"> </th> <!-- Detail hyper-link column --> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Madinoz Pty Ltd</td> <td class="grid">Madinoz Pty Ltd</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=2">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=2">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Fitzroy Track Systemss</td> <td class="grid">Charles Marshall Pty Ltd</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=3">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=3">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Automated Disability Access Systems</td> <td class="grid">ADAS Pty Ltd</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=4">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=4">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Cabinet Hardware Supplies</td> <td class="grid">Cabinet Hardware Supplies</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=5">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=5">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Contract Hardware</td> <td class="grid">Cabinet Hardware Supplies</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=6">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=6">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">D Line</td> <td class="grid">Keeler Hardware</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=7">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=7">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Olivari</td> <td class="grid">Bellevue Imports Pty Ltd</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=8">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=8">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Style Finish Hardware</td> <td class="grid">Style Finish </td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=9">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=9">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">Centor Sliding Door Tracks</td> <td class="grid">Centor Products Pty Ltd</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=10">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=10">Detail</a> </td> </tr> <tr class="grid"> <!-- <td class='grid_td'> <input type="checkbox" name="selectedrow[]" value="<?php echo $row['id']; ?>" > </td> --> <td class="grid">O'Briens Automatic Door & Gate Systems</td> <td class="grid">KABA Door Systems</td> <td class="grid">Completetion of structure</td> <td class="grid">Doors: parts, accessories</td> <td class="grid" style="width:120px;"> BNE | SC | HB</td> <td class="grid">1</td> <td class="grid">31.59</td> <td class="grid" style="text-align: right;"><a href="http://localhost/corearch2/catalogue_detail.php?id=11">Edit</a> | <a href="http://localhost/corearch2/catalogue_detail.php?id=11">Detail</a> </td> </tr> </tbody></table> <br> </div> <!-- end of body content --> </div> <div id="footer"> <div class="content"> Copyright 2013 </div> </div> </div> <div id="directions_extension" style="display: none;"></div></body></html> Include the js library only once inside the header template file and be careful when you're creating your templates structure.
-
I will check tomorrow. There is too much code for this time of the night
-
No, don't push me to use twig Give us the generated html code. Open up the source code of this html document and post out the result.
-
Combining 3 output from 3 queries in mysql and do some calculations
jazzman1 replied to mikeyoung's topic in MySQL Help
O, my master! One more amazing sql select statement. Forever stay your fan. I like that -
So, if I understand you correctly, you get some values from these 2 drop-down lists by Ajax using the jquery change event. After that, you try to toggle it inside "#fld_notes" by clicking on #notes_sh label and nothing happens, right? Can you post out all relevant js code and some sample with html data.
-
Why do you want to use this apache module in php? If godaddy does not provide you by default this option (check inside php.ini file), just you don't need that. I'm on godaddy too and often use apche mod_rewite without php at all.
- 45 replies
-
- apache
- mod_rewrite
-
(and 1 more)
Tagged with: