Jump to content

Bravat

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Bravat's Achievements

Member

Member (2/5)

0

Reputation

  1. Ooops, my bad . AyKay47 it is working, but I forgot to tell you. Thank you for helping me
  2. Nodral I want to be able to update table products when new images is not selected. If I write query this way: $sql = mysql_query("UPDATE products SET product_name = '$productName', image = '$productImage', price = '$productPrice', description = '$productDetails', category_id = '$producteCagegory', subcategory_id = '$productSubcategory' WHERE id_product = '{$_POST[idProduct]}'") then table is updated and new value for image, if nothing is selected, is NULL (works fine when new image is selected). There is no error, simply nothing happens.
  3. I have this block of code: if(isset ($_POST['submit'])) { $productName = mysql_real_escape_string($_POST['productName']); $productPrice = mysql_real_escape_string($_POST['productPrice']); $producteCagegory = mysql_real_escape_string($_POST['productCategory']); $productSubcategory = mysql_real_escape_string($_POST['productSubcategory']); $productDetails = mysql_real_escape_string($_POST['productDetails']); $productImage = $_FILES['productImage']['name']; $sql = mysql_query("UPDATE products SET product_name = '$productName', "); if($productImage != ""){ $sql .= (" image = '$productImage' " ); } $sql .= ( " , price = '$productPrice', description = '$productDetails', category_id = '$producteCagegory', subcategory_id = '$productSubcategory' WHERE id_product = '$_POST[idProduct]' ") or die(mysql_error()); if(!empty($productImage)) { move_uploaded_file($_FILES["productImage"]["tmp_name"], IMG_UPLOAD . $_FILES["productImage"]["name"]); } redirect_to("inventory_edit.php?pid=$_POST[idProduct]"); } Idea is that if no new image is selected, query does not update image field. What am I doing wrong, and how to do this?
  4. Ok, I will go that way. Thanks for advice
  5. I am standing confused I don't want to have situation where I have a 100 rows for one item (id1 is related to id2(one row), id2-id3 (second row) and so on). In that case i will have one big table (for example if I have 1000 items, that are related with 100 other items that will be 100,000 rows). I want to put 100 related items in one row, and that is puzzling me.
  6. That is the way I made table. I want to put more then one item_id in single row, and latter to be able to use stored item_ids for query. For example: item_id:1 is related with item_id2, item_id3, item_id4... (I don't know how to do this). Latter I want to do something like this: SELECT * FROM item WHERE item_id = (and here I insert values for related_id)
  7. I have table related where i need to store all items that are related to the specific one. I know how to create multiple rows (for example item:id1 is related to item:id2, item:id1 is related to item:id3, item:id1 is related to item:id4 and so one ). How can store all that in one row (item:id1 is related to item:id2,item:id3....) and later be able to use this for query?
  8. Well I am creating site for internal use, so I thought that I don't need to use mysql_real_escape_string(). In order to work I need to delete htmlspecialchars()?
  9. This is the page associated with JS: <div class="articlesQuote" id="article"> <div class="heading"> <h1 id="newTitle">Get a Free Quote</h1> </div> <div class="articletxt"> <p>Please fill out the form below. When you are finished our automated system will calculate the price for your project. Take note that the price is orientative and will vary depending on active discounts and promotions!</p> <div class="quote"><form id="forma" action="actions/quote.php" method="post" name="forma"> <div class="form_para"><fieldset id="legborder"><legend id="legend">Contact Information</legend> <div id="fieldset"><label class="labela" for="ime">Your Name *: </label><input id="ime" type="text" name="ime" size="30" /><br /> <div id="forma_ime_errorloc" class="error_strings"> </div> <script type="text/javascript">// <![CDATA[ $(document).ready(function() { if (!("autofocus" in document.createElement("input"))) { $("#ime").focus(); } }); // ]]></script> <label class="labela" for="email">Your Email *: </label><input id="email" type="email" name="email" size="30" /><br /> <div id="forma_email_errorloc" class="error_strings"> </div> <label class="labela" for="kompanija">Company: </label><input id="kompanija" type="text" name="kompanija" size="30" /></div> </fieldset></div> <div class="form_para"><fieldset id="legborder"><legend id="legend">Project Information</legend> <div id="fieldset"><label class="labela" for="usluga">Type of website services *: </label> <select id="usluga" name="usluga"><option value="Select One...">Select One...</option><option value="Design of an entirely new website">Design of an entirely new website</option><option value="Complete redesign of a website">Complete redesign of a website</option><option value="Maintenance or upgrade to an existing website">Maintenance or upgrade to an existing website</option><option value="eCommerce Website">eCommerce Website</option><option value="Search Engine Optimization">Search Engine Optimization</option><option value="Other">Other</option></select><br /> <label class="labela" for="sajt">If you have a website. please indicate the URL: </label><input id="sajt" type="url" name="sajt" value="http://" size="30" /><br /> <br /> <label class="labela" for="logo">Do you have a logo for your new site?: </label> <select id="logo" name="logo"><option value="Yes">Yes</option><option value="No">No</option></select><br /> <label class="labela" for="budzet">Project Budget *: </label><select id="budzet" name="budzet"><option value="200$-500$">200$-500$</option><option value="500$-1000$">500$-1000$</option><option value="1000$-1500$">1000$-1500$</option><option value="1500$-2000$">1500$-2000$</option><option value="2000$-2500$">2000$-2500$</option><option value="2500$-5000$">2500$-5000$</option><option value="5000$ or more">5000$ or more</option></select><br /> <label class="labela" for="domen">Domain Name Registration: </label> <select id="domen" name="domen"><option value="Select One...">Select One...</option><option value="I need a Domain Name registered">I need a Domain Name registered</option><option value="I already have a Domain Name">I already have a Domain Name</option><option value="Not Sure Yet, Please Contact Me">Not Sure Yet, Please Contact Me</option></select><br /> <label class="labela" for="hosting">Website Hosting: </label> <select id="hosting" name="hosting"><option value="Select One...">Select One...</option><option value="I need Website Hosting">I need Website Hosting</option><option value="I already have Website Hosting">I already have Website Hosting</option><option value="Not Sure Yet, Please Contact Me">Not Sure Yet, Please Contact Me</option></select><br /> <label class="labela" for="opis">Which description best represents your desired e-store?</label> <select id="opis" name="opis"><option value="We do not intend to sell products on our site right now.">We do not intend to sell products on our site right now.</option><option value="Small store on a new site with a fewer than 40 products; paypal integration should do the trick.">Small store on a new site with a fewer than 40 products; paypal integration.</option><option value="We need a merchant account and have up to several hundred products; frequent updates.">We need a merchant account, up to several hundred products; we will update the store often.</option><option value="We are going to offer subscriptions and/or downloadable files.">We are going to offer subscriptions and/or downloadable files.</option></select><br /> <br /> <label class="labela" for="start">Project Start: </label> <select id="start" name="start"><option value="Select One....">Select One....</option><option value="ASAP">ASAP</option><option value="1-2 weeks">1-2 weeks</option><option value="3-4 weeks">3-4 weeks</option><option value="4+ weeks">4+ weeks</option></select><br /> <label class="labela" for="slicnost">Other websites that match the design and/or functionality you want for your website: </label> <input id="slicnost" type="url" name="slicnost" value="http://" size="30" /><br /> <input id="slicnost1" type="url" name="slicnost1" value="http://" size="30" /><br /> <label class="labela" for="poruka">Please describe your website project. </label><textarea id="poruka" class="txtarea" name="poruka" rows="9" cols="40"></textarea></div> </fieldset></div> <div class="form_para"><fieldset id="legborder"><legend id="legend">Other Important Functions Required</legend> <div class="radio_butt"><input id="cms" type="checkbox" name="cms" value="CMS and Website Editing" /> CMS - Website Editing<br /> <input id="blog" type="checkbox" name="blog" value="Blog" /> Blog<br /> <input id="feedback_forms" type="checkbox" name="feedback_forms" value="Feedback Forms" /> Feedback Forms<br /> <input id="newsletter" type="checkbox" name="newsletter" value="Newsletter Management" /> Newsletter Management</div> <div class="radio_butt"><input id="application_forms" type="checkbox" name="application_forms" value="Application Forms" /> Application Forms<br /> <input id="surveys" type="checkbox" name="surveys" value="Polls & Surveys" /> Polls & Surveys<br /> <input id="community_forum" type="checkbox" name="community_forum" value="Community Forum" /> Community Forum<br /> <input id="gallery_quote" type="checkbox" name="gallery" value="Photo Gallery" /> Photo Gallery</div> <div class="radio_butt"><input id="flash_headers" type="checkbox" name="flash_headers" value="Flash Headers" /> Headers<br /> <input id="tell_a_friend" type="checkbox" name="tell_a_friend" value="Tell_A_Friend Feature" /> Tell-A-Friend Feature<br /> <input id="website_search" type="checkbox" name="website_search" value="Website Search" /> Website Search<br /> <input id="registration" type="checkbox" name="registration" value="registration" /> Registration/Membership</div> <div class="radio_butt"><input id="call_back_forms" type="checkbox" name="call_back_forms" value="Call Back Forms" /> Call Back Forms<br /> <input id="file_uploading" type="checkbox" name="file_uploading" value="File Uploading" /> File Uploading<br /> <input id="social_media" type="checkbox" name="social_media" value="social_media" /> Social Media Integration<br /> <input id="logins" type="checkbox" name="logins" value="User/Password Logins" /> User/Password Logins</div> <div class="radio_butt"><input id="live_support" type="checkbox" name="live_support" value="Live Support" /> Live Support<br /> <input id="chat_room" type="checkbox" name="chat_room" value="Chat Room" /> Chat Room<br /> <input id="bilingual_text" type="checkbox" name="bilingual_text" value="Bilingual Text" /> Bilingual Text</div> </fieldset></div> <input class="buttons" type="submit" name="submit" value="submit" /> </form></div> </div> </div> --------This is JS which controls form----- <script type="text/javascript">// <![CDATA[ var frmvalidator = new Validator("forma"); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("ime","req","Please enter your First Name"); frmvalidator.addValidation("ime","maxlen=20", "Max length for FirstName is 20"); frmvalidator.addValidation("email","maxlen=50"); frmvalidator.addValidation("email","req","Please enter your Email"); // ]]></script> This is the way I use to store page into DB: if(isset($_POST['submit_no_roller'])){ $body = htmlspecialchars($_POST['body1']); $naslov = $_POST['naslov']; $lang_short = $_POST['lang_short']; $pozicija = $_POST['pozicija']; $query = "INSERT INTO pages VALUES (NULL, '$body', 0, '$naslov', '$pozicija', '$lang_short')"; $result = mysql_query($query); }
  10. Well I am new to web, PHP and MySQL and it seems good idea to store hole page into DB for easier accesses . Into DB is stored body of the page without header and footer. There is no error when I put page into DB. Everything is putted fine, but JS isn't loaded. However, when I put JS in footer.php it is loaded but I get this error: Error: couldn't get Form object forma. Error is on every other page, except on the page where form is located.
  11. I have html page inserted into table, and I need to insert JS that is specific for that page. When I insert it in DB nothing happens, but when I put it into footer.php it works just fine, but I keep getting error until I go to the specific page (JS is searching for specific form to load). I use function "htmlspecialchars" to insert page into DB. Does this have something to do with this. This is JS code: <script type="text/javascript">// <![CDATA[ var frmvalidator = new Validator("forma"); frmvalidator.EnableOnPageErrorDisplay(); frmvalidator.EnableMsgsTogether(); frmvalidator.addValidation("ime","req","Please enter your First Name"); frmvalidator.addValidation("ime","maxlen=20", "Max length for FirstName is 20"); frmvalidator.addValidation("email","maxlen=50"); frmvalidator.addValidation("email","req","Please enter your Email"); // ]]></script>
  12. Oops, my bad. This is line that is giving error: $jezik = getLanguage($languages, $lang , '2'); Thank you for detail explanation , it is very helpful .
  13. It is working , but I have a bit of a problem. Language selection is working, but when I go to some link within that language I get this error: Notice: Undefined index: lang in C:\wamp\www\ads\layout\head.php on line 4 and this is line 4: $languages = array ('Serbian'=>'1', 'English'=>'2'); And one more question, how I get language list from DB and put it into array (First go name of the language and then id of the language from DB)?
  14. Thank you . I will give a try .
  15. I want to create multilingual website using php script. I have MySQL table with language (with this fields: id_lang, lang, image, pozicija). So far I did this: if(isset($_GET['language'])){ $_SESSION['jezik'] = $_GET['language']; } elseif(!isset($_GET['language'])){ $_SESSION['jezik'] = 2; } When I choose new language it is working, but when I choose another link inside that language it is back to the default one. Here is the code for menu: $query_meni = "SELECT * FROM pages WHERE lang_id = '$jezik' ORDER BY pozicija"; $result = mysql_query($query_meni); $count = mysql_affected_rows(); if($count >0 ){ while($row_meni = mysql_fetch_array($result)){ $link = $row_meni['id_pages']; $show = $row_meni['naslov']; echo "<li><a href=\"index.php?page=$link\">$show</a>"; $query_subject = "SELECT * FROM subjects WHERE pages_id = '$row_meni[id_pages]' AND lang_id = '$jezik' ORDER BY pozicija ASC"; $result1 = mysql_query($query_subject); $count1 = mysql_affected_rows(); if($count1 == 0){ echo "</li>"; } else { echo "<ul class=\"subnav\">"; while($row_subjects = mysql_fetch_array($result1)){ $link1 = $row_subjects['subject_id']; $show1 = $row_subjects['naslov']; echo "<li> <a href=\"index.php?subject=$link1\">$show1</a></li>"; } echo "</ul>"; } echo "</li>"; } echo "</li>"; } echo "</li>"; ?> What am I doing wrong?
×
×
  • 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.