[PHP] Furni SQL Syntax Generator

Status
Not open for further replies.
Web Developer
Joined
Oct 24, 2009
Messages
534
Reaction score
217
SQL Syntax Generator​

Features:
  • checks if fields are incomplete
  • checks the values that are supposed to be numeric are numeric.
  • gives you an MySQL code and a PHP code.
  • tidy layout

Demo:
Click (may go down).

Codes:
index.php
PHP:
<!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=utf-8" />
		<title>SQL Syntax Generator</title>
		<link rel="stylesheet" href="stylesheet/style.css" />
		<script type="text/javascript">
			function sel(id){
				document.getElementById(id).focus();
				document.getElementById(id).select();
			}
			function moreCreditsAndStuffLikeThat(){
				m0nsta = 'This product was developed by m0nsta./markeriksson94/iiM4RKx (same person) from RaGEZONE.com\n\nThe original idea was by Drawking from RaGEZONE.com but Stopthatwinkie took his idea and re-did it.\n\nThe threadof Stopthatwinkie is this link: http://forum.ragezone.com/f353/mysql-furniture-code-generator-625374/.\n\nI would also like to thank \'What?\' from RaGEZONE too for re-uploading the program that Stopthatwinkie produced so I didn\'t have to wait 10 minutes to download it.\n\n-----------------------------------------------\n\nIf you are thinking of removing credits to me - die.';
				alert(m0nsta);
			}
		</script>
	</head>
	<div id="tagscanner">
		<div style="text-align: center">
			<form method="post">
				<table width="100%">
					<tbody>
						<tr>
							<td><label for="tid">TID:</label></td>
							<td><input tabindex="1" title="ID of the Catalogue page this item will be in" type="text" name="tid" id="tid" class="scanclass"></td>
						</tr>
						<tr>
							<td><label for="cctname">CCT Name:</label></td>
							<td><input tabindex="2" type="text" name="cctname" id="cctname" class="scanclass"></td>
						</tr>
						<tr>
							<td><label for="catidpage">Catalogue ID Page:</label></td>
							<td><input tabindex="3" type="text" name="catidpage" id="catidpage" class="scanclass"></td>
						</tr>
						<tr>
							<td><label for="cost">Cost:</label></td>
							<td><input tabindex="4" title="Cost of item in credits" type="text" name="cost" id="cost" value="Credits" class="scanclass"> <input tabindex="5" title="Cost of item in Pixels" type="text" name="pixels" id="pixels" value="Pixels" class="scanclass"></td>
						</tr>
						<tr>
							<td><label for="top">Top:</label></td>
							<td><input tabindex="6" type="text" name="top" id="top" value="0.00" class="scanclass"></td>
						</tr>
						<tr>
							<td><label for="status_max">Status Max:</label></td>
							<td><input tabindex="7" type="text" name="status_max" id="status_max" class="scanclass"></td>
						</tr>
						<tr>
							<td><label for="drink">Drink:</label></td>
							<td><select tabindex="8" title="Does this item give drinks? If so, what drink does it give?" name="drink" id="drinks" class="scanclass">
									<?php
									$drinks = array("0" => "No drink","1" => "Tea","2" => "Juice","3" => "Carrot","4" => "Icecream","5" => "Milk","6" => "Blackcurrant","7" => "Water","8" => "Regular","9" => "Decaff","10" => "Latte","11" => "Mocha","12" => "Macchiato","13" => "Espresso","14" => "Filter","15" => "Iced","16" => "Cappuccino","17" => "Java","18" => "Tap","19" => "Cola","20" => "Camera","21" => "Hamburger","22" => "Lime Soda","23" => "Beetroot","24" => "Bubble Juice","25" => "Love Potion");
									foreach($drinks as $key=>$value){
										echo '<option value="'.$key.'">'.$value.'</option>';
									}
									?>
								</select></td>
						</tr>
						<tr>
							<td><label for="type">Type:</label></td>
							<td><select tabindex="9" title="What type of item is this? See options." name="type" id="type" class="scanclass">
									<?php
									$types = array("0" => "Wall Item","1" => "Solid","2" => "Seat","3" => "Bed","4" => "Rug/Mat");
									foreach($types as $key=>$value){
										echo '<option value="'.$key.'">'.$value.'</option>';
									}
									?>
								</select></td>
						</tr>
						<tr>
							<td><label for="t">Tradable:</label></td>
							<td><input tabindex="10" title="Is this item allowed to be traded?" type="checkbox" name="t" id="t" value="1" class="scanclass" checked></td>
						</tr>
						<tr>
							<td><label for="r">Recyclable:</label></td>
							<td><input tabindex="11" title="Is this item allowed to be recycled?" type="checkbox" name="r" id="r" value="1" class="scanclass" checked></td>
						</tr>
						<tr>
							<td><label for="rr">Rights Required:</label></td>
							<td><input tabindex="12" title="Are room rights required to use this item?" type="checkbox" name="rr" id="rr" value="1" class="scanclass" checked></td>
						</tr>
						<tr>
							<td><label for="d">Door:</label></td>
							<td><input tabindex="13" title="Is this item a door?" type="checkbox" name="d" id="d" value="0" class="scanclass"></td>
						</tr>
						<tr>
							<td><label for="nt">Next To:</label></td>
							<td><input tabindex="14" title="Do you have to be stood next to the item to use it?" type="checkbox" name="nt" id="nt" value="0" class="scanclass"></td>
						</tr>
						<tr>
							<td><input tabindex="15" title="If you are satisfied with the details you have provided, click this button!" type="submit" value="Create SQL Syntax!" name="sql_make" class="scanclass"></td>
							<td></td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
		<div name="results" id="results">
			<div style="text-align: center">
				<?php
				if(isset($_POST['sql_make'])){
					$tid = strip_tags(stripslashes($_POST['tid']));
					$cctname = strip_tags(stripslashes($_POST['cctname']));
					$catidpage = strip_tags(stripslashes($_POST['catidpage']));
					$cost_credits = strip_tags(stripslashes($_POST['cost']));
					$cost_pixels = strip_tags(stripslashes($_POST['pixels']));
					$top = strip_tags(stripslashes($_POST['top']));
					$statusmax = strip_tags(stripslashes($_POST['status_max']));
					$drink = strip_tags(stripslashes($_POST['drink']));
					$type = strip_tags(stripslashes($_POST['type']));
					$error = '';
					if($_POST['t'] == '1'){
						$t = '1';
					}else{
						$t = '0';
					}
					if($_POST['r'] == '1'){
						$r = '1';
					}else{
						$r = '0';
					}
					if($_POST['rr'] == '1'){
						$rr = '1';
					}else{
						$rr = '0';
					}
					if($_POST['d'] == '1'){
						$d = '1';
					}else{
						$d = '0';
					}
					if($_POST['nt'] == '1'){
						$nt = '1';
					}else{
						$nt = '0';
					}
					if(!$tid || !$cctname || !$catidpage || !$cost_credits || !$cost_pixels || !$top || !$statusmax || !$type || !$drink){
						$error .= '<li>All fields are required.</li>';
					}else{
						if(is_numeric($cost_credits) == false){
							$error .= '<li>The cost of credits must be numeric!</li>';
						}else{
							if(is_numeric($cost_pixels) == false){
								$error .= '<li>The cost of pixels must be numeric!</li>';
							}
						}
					}
					if(!$error){
						$sql_mysql = "INSERT INTO `catalogue_items` (`tid`, `catalogue_cost_credits`, `catalogue_cost_pixels`, `typeid`, `top`, `name_cct`, `status_max`, `rights_required`, `next_to_required`, `drink_ids`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `catalogue_id_index`) VALUES ('".$tid."', '".$cost_credits."', '".$cost_pixels."', '".$type."', '".$top."', '".$cctname."', '".$statusmax."', '".$rr."', '".$nt."', '".$drink."', '".$catidpage."', '".$d."', '".$t."', '".$r."', '".$tid."')";
						$sql_php = "<?php mysql_query(\"INSERT INTO `catalogue_items` (`tid`, `catalogue_cost_credits`, `catalogue_cost_pixels`, `typeid`, `top`, `name_cct`, `status_max`, `rights_required`, `next_to_required`, `drink_ids`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `catalogue_id_index`) VALUES ('".$tid."', '".$cost_credits."', '".$cost_pixels."', '".$type."', '".$top."', '".$cctname."', '".$statusmax."', '".$rr."', '".$nt."', '".$drink."', '".$catidpage."', '".$d."', '".$t."', '".$r."', '".$tid."')\"); ?>";
						echo '<strong><u>Results</u></strong><br><br>
						
						<strong>MySQL Query Code:</strong><br>
						<textarea class="scanclass" name="sql_mysql" id="sql_mysql" style="width:100%;" onclick="sel(\'sql_mysql\');" readonly>'.$sql_mysql.'</textarea>
						
						<br><br>
						
						<strong>PHP Query Code:</strong><br>
						<textarea class="scanclass" name="sql_php" id="sql_php" style="width:100%;" onclick="sel(\'sql_php\');" readonly>'.$sql_php.'</textarea>';
					}else{
						echo 'Sorry, we could not generate your SQL Syntax as the following error(s) occurred:<ul>'.$error.'</ul>';
					}
				}
				?>
			</div>
		</div>
	</div>
	<div>
		<center>
			<i>© Mark Eriksson 2010.<br>Coding and programming by Mark Eriksson (m0nsta./markeriksson94/iiM4RKx (same person)).<br>I'm not sure who did the design, but credits to them.<br>Click <strong><a href="mailto:[email protected]">here</a></strong> to send me an e-mail.<br>Click <strong><a href="javascript:moreCreditsAndStuffLikeThat();">here</a></strong> for more information on this product.</i>
		</center>
	</div>
	</body>
</html>

/stylesheet/style.css
Code:
body 
{
	padding:0;
	margin:0;
	font-size: 11px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}

#tagscanner
{
	height: 100%;
	width: 500px;
	margin: 0 auto;
	margin-top: 15px;
	position: relative;
	padding: 5px;
	border:1px dotted #FC6204;
	font: bold 11px Verdana;
	color: #FC6204;
}

.scanclass
{
	border:1px dotted #000;
	background:#FC6204;
	font:bold 11px Verdana;
	color:#FFF;
	margin-left:2px;
}

#results
{
	height:auto;
	max-height:500px;
	border:2px solid #EFEFEF;
	margin-top:5px;
	width:485px;
	padding:5px;
	font:bold 11px Verdana;
	color:red;
	overflow-y:auto;
	overflow-x:hidden;
}
input
{
	margin-bottom: 5px;
}

If you are too lazy to copy them codes, click .

Have fun, hope it helps
- m0nsta.
 
Last edited:
Very Very nice release m0nsta. I am going to use it.

Thanks :):

---------- Post added at 09:17 PM ---------- Previous post was at 09:17 PM ----------

One question. Is this for v26?

You know how I PM'ed you asking for the latest version Stopthatwinkie's program, it's that
I think it is V35. I'm not sure.
 
Nice!

Heres an r26 version :D

Preview:
Code:
<?php //r26 by stopthattwinkie :] ?>
<!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=utf-8" /> 
        <title>SQL Syntax Generator</title> 
        <link rel="stylesheet" href="sql.css" /> 
        <script type="text/javascript"> 
            function sel(id){ 
                document.getElementById(id).focus(); 
                document.getElementById(id).select(); 
            } 
            function moreCreditsAndStuffLikeThat(){ 
                m0nsta = 'This product was developed by m0nsta./markeriksson94/iiM4RKx (same person) from RaGEZONE.com\n\nThe original idea was by Drawking from RaGEZONE.com but Stopthatwinkie took his idea and re-did it.\n\nThe threadof Stopthatwinkie is this link: http://forum.ragezone.com/f353/mysql-furniture-code-generator-625374/.\n\nI would also like to thank \'What?\' from RaGEZONE too for re-uploading the program that Stopthatwinkie produced so I didn\'t have to wait 10 minutes to download it.\n\n-----------------------------------------------\n\nIf you are thinking of removing credits to me - die.'; 
                alert(m0nsta); 
            } 
        </script> 
    </head> 
    <div id="tagscanner"> 
        <div style="text-align: center"> 
            <form method="post"> 
                <table width="100%"> 
                    <tbody> 
                        <tr> 
                            <td><label for="tid">TID:</label></td> 
                            <td><input tabindex="1" title="ID of the Catalogue page this item will be in" type="text" name="tid" id="tid" class="scanclass"></td> 
                        </tr>
                        <tr>
                        <td><label for="cat_name">Catalog Name:</label></td>
                        <td><input tabindex="2" title="Name of furniture in catalog" type="text" name="cat_name" id="cat_name" class="scanclass" /></td>
                        </tr>
                        <tr>
                        <td><label for="cat_desc">Catalog Description:</label></td>
                        <td><input tabindex="3" title="Description of the furniture in catalog" type="text" name="cat_desc" id="cat_desc" class="scanclass" /></td>
                        </tr>
                        <tr> 
                            <td><label for="cost">Cost:</label></td> 
                            <td><input tabindex="4" title="Cost of item" type="text" name="cost" id="cost" class="scanclass"></td> 
                        </tr>
                        <tr> 
                            <td><label for="type">Type:</label></td> 
                            <td><select tabindex="5" title="What type of item is this? See options." name="type" id="type" class="scanclass"> 
                                    <?php 
                                    $types = array("0" => "Wall Item","1" => "Solid","2" => "Seat","3" => "Bed","4" => "Rug/Mat"); 
                                    foreach($types as $key=>$value){ 
                                        echo '<option value="'.$key.'">'.$value.'</option>'; 
                                    } 
                                    ?> 
                                </select></td> 
                        </tr>
                        <tr>
                        <td><label for="length">Length:</label></td>
                        <td><input tabindex="6" title="How long (in tiles) is this furniture?" name="length" id="length" class="scanclass"></td>
                        </tr>
                        <tr>
                        <td><label for="width">Width:</label></td>
                        <td><input tabindex="7" title="How wide (in tiles) is this furniture?" name="width" id="width" class="scanclass" /></td>
                        </tr>
                        <tr> 
                            <td><label for="top">Top:</label></td> 
                            <td><input tabindex="8" title="How tall is this item? (Unit is unknown)" type="text" name="top" id="top" value="0.00" class="scanclass"></td> 
                        </tr> 
                        
                        <tr> 
                            <td><label for="cctname">CCT Name:</label></td> 
                            <td><input tabindex="9" type="text" name="cctname" id="cctname" class="scanclass"></td> 
                        </tr> 
                        <tr>
                        <td><label for="color">Color:</label></td>
                        <td><input tabindex="10" type="text" name="color" id="color" value="0,0,0" class="scanclass" /></td>
                        </tr>
                        
                        <tr> 
                            <td><label for="catidpage">Catalogue ID Page:</label></td> 
                            <td><input tabindex="11" type="text" name="catidpage" id="catidpage" class="scanclass"></td> 
                        </tr>
                        <tr> 
                            <td><label for="t">Tradable:</label></td> 
                            <td><input tabindex="12" title="Is this item allowed to be traded?" type="checkbox" name="t" id="t" value="1" class="scanclass" checked></td> 
                        </tr> 
                        <tr> 
                            <td><label for="r">Recyclable:</label></td> 
                            <td><input tabindex="13" title="Is this item allowed to be recycled?" type="checkbox" name="r" id="r" value="1" class="scanclass" checked></td> 
                        </tr>
                        <tr> 
                            <td><label for="d">Door:</label></td> 
                            <td><input tabindex="14" title="Is this item a door?" type="checkbox" name="d" id="d" value="0" class="scanclass"></td> 
                        </tr>
                        <tr> 
                            <td><input tabindex="15" title="If you are satisfied with the details you have provided, click this button!" type="submit" value="Create SQL Syntax!" name="sql_make" class="scanclass"></td> 
                            <td></td> 
                        </tr> 
                    </tbody> 
                </table> 
            </form> 
        </div> 
        <div name="results" id="results"> 
            <div style="text-align: center"> 
                <?php 
                if(isset($_POST['sql_make'])){ 
                    $tid = strip_tags(stripslashes($_POST['tid'])); 
                    $cctname = strip_tags(stripslashes($_POST['cctname'])); 
					$catname = strip_tags(stripslashes($_POST['cat_name']));
					$catdesc = strip_tags(stripslashes($_POST['cat_desc']));
                    $catidpage = strip_tags(stripslashes($_POST['catidpage'])); 
                    $cost = strip_tags(stripslashes($_POST['cost']));  
                    $top = strip_tags(stripslashes($_POST['top'])); 
                    $type = strip_tags(stripslashes($_POST['type']));
					$length = strip_tags(stripslashes($_POST['length']));
					$width = strip_tags(stripslashes($_POST['width']));
					$color = strip_tags(stripslashes($_POST['color']));
                    $error = ''; 
                    if($_POST['t'] == '1'){ 
                        $t = '1'; 
                    }else{ 
                        $t = '0'; 
                    } 
                    if($_POST['r'] == '1'){ 
                        $r = '1'; 
                    }else{ 
                        $r = '0'; 
                    } 
                    if($_POST['d'] == '1'){ 
                        $d = '1'; 
                    }else{ 
                        $d = '0'; 
                    } 
                    if(!$tid || !$cat_name || !$cat_desc || !$cost || !$cctname || !$catidpage || !$top || !$length || !$width || !$type || !$color|| !$drink){ 
                        $error .= '<li>All fields are required.</li>'; 
                    }else{ 
                        if(is_numeric($cost) == false){ 
                            $error .= '<li>The cost of credits must be numeric!</li>'; 
                        }else{ 
                            if(is_numeric($length) == false){ 
                                $error .= '<li>The length must be numeric!</li>'; 
                            }else{
								if(is_numeric($width) == false){
									$error .='<li>The width must be numeric!</lt>';
								}
							}
                        } 
                    } 
                    if(!$error){ 
                        $sql_mysql = "INSERT INTO `catalogue_items` (`tid`, `catalogue_name`, `catalogue_desc`, `catalogue_cost`, `typeid`, `length`, `width`, `top`, `name_cct`, `colour`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `picture`, `catalogue_id_index`) VALUES ('".$tid."', '".$catname."', '".$catdesc."', '".$cost."', '".$type."', '".$length."', '".$width."', '".$top."', '".$cctname."', '".$color."', '".$catidpage."', '".$d."', '".$t."', '".$r."', 'placeholder.gif', '".$tid."')"; 
                        $sql_php = "<?php mysql_query(\"INSERT INTO `catalogue_items` (`tid`, `catalogue_name`, `catalogue_desc`, `catalogue_cost`, `typeid`, `length`, `width`, `top`, `name_cct`, `colour`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `picture`, `catalogue_id_index`) VALUES ('".$tid."', '".$catname."', '".$catdesc."', '".$cost."', '".$type."', '".$length."', '".$width."', '".$top."', '".$cctname."', '".$color."', '".$catidpage."', '".$d."', '".$t."', '".$r."', 'placeholder.gif', '".$tid."')\"); ?>"; 
                        echo '<strong><u>Results</u></strong><br><br> 
                         
                        <strong>MySQL Query Code:</strong><br> 
                        <textarea class="scanclass" name="sql_mysql" id="sql_mysql" style="width:100%;" onclick="sel(\'sql_mysql\');" readonly>'.$sql_mysql.'</textarea> 
                         
                        <br><br> 
                         
                        <strong>PHP Query Code:</strong><br> 
                        <textarea class="scanclass" name="sql_php" id="sql_php" style="width:100%;" onclick="sel(\'sql_php\');" readonly>'.$sql_php.'</textarea>'; 
                    }else{ 
                        echo 'Sorry, we could not generate your SQL Syntax as the following error(s) occurred:<ul>'.$error.'</ul>'; 
                    } 
                } 
                ?> 
            </div> 
        </div> 
    </div> 
    <div> 
        <center> 
            <i>© Mark Eriksson 2010.<br>Coding and programming by Mark Eriksson (m0nsta./markeriksson94/iiM4RKx (same person)).<br>I'm not sure who did the design, but credits to them.<br>Click <strong><a href="mailto:[email protected]">here</a></strong> to send me an e-mail.<br>Click <strong><a href="javascript:moreCreditsAndStuffLikeThat();">here</a></strong> for more information on this product.</i> 
      </center> 
    </div> 
    </body>
</html>
 
Last edited:
Nice!

Heres an r26 version :D

Preview:
Code:
<?php //r26 by stopthattwinkie :] ?>
<!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=utf-8" /> 
        <title>SQL Syntax Generator</title> 
        <link rel="stylesheet" href="sql.css" /> 
        <script type="text/javascript"> 
            function sel(id){ 
                document.getElementById(id).focus(); 
                document.getElementById(id).select(); 
            } 
            function moreCreditsAndStuffLikeThat(){ 
                m0nsta = 'This product was developed by m0nsta./markeriksson94/iiM4RKx (same person) from RaGEZONE.com\n\nThe original idea was by Drawking from RaGEZONE.com but Stopthatwinkie took his idea and re-did it.\n\nThe threadof Stopthatwinkie is this link: http://forum.ragezone.com/f353/mysql-furniture-code-generator-625374/.\n\nI would also like to thank \'What?\' from RaGEZONE too for re-uploading the program that Stopthatwinkie produced so I didn\'t have to wait 10 minutes to download it.\n\n-----------------------------------------------\n\nIf you are thinking of removing credits to me - die.'; 
                alert(m0nsta); 
            } 
        </script> 
    </head> 
    <div id="tagscanner"> 
        <div style="text-align: center"> 
            <form method="post"> 
                <table width="100%"> 
                    <tbody> 
                        <tr> 
                            <td><label for="tid">TID:</label></td> 
                            <td><input tabindex="1" title="ID of the Catalogue page this item will be in" type="text" name="tid" id="tid" class="scanclass"></td> 
                        </tr>
                        <tr>
                        <td><label for="cat_name">Catalog Name:</label></td>
                        <td><input tabindex="2" title="Name of furniture in catalog" type="text" name="cat_name" id="cat_name" class="scanclass" /></td>
                        </tr>
                        <tr>
                        <td><label for="cat_desc">Catalog Description:</label></td>
                        <td><input tabindex="3" title="Description of the furniture in catalog" type="text" name="cat_desc" id="cat_desc" class="scanclass" /></td>
                        </tr>
                        <tr> 
                            <td><label for="cost">Cost:</label></td> 
                            <td><input tabindex="4" title="Cost of item" type="text" name="cost" id="cost" class="scanclass"></td> 
                        </tr>
                        <tr> 
                            <td><label for="type">Type:</label></td> 
                            <td><select tabindex="5" title="What type of item is this? See options." name="type" id="type" class="scanclass"> 
                                    <?php 
                                    $types = array("0" => "Wall Item","1" => "Solid","2" => "Seat","3" => "Bed","4" => "Rug/Mat"); 
                                    foreach($types as $key=>$value){ 
                                        echo '<option value="'.$key.'">'.$value.'</option>'; 
                                    } 
                                    ?> 
                                </select></td> 
                        </tr>
                        <tr>
                        <td><label for="length">Length:</label></td>
                        <td><input tabindex="6" title="How long (in tiles) is this furniture?" name="length" id="length" class="scanclass"></td>
                        </tr>
                        <tr>
                        <td><label for="width">Width:</label></td>
                        <td><input tabindex="7" title="How wide (in tiles) is this furniture?" name="width" id="width" class="scanclass" /></td>
                        </tr>
                        <tr> 
                            <td><label for="top">Top:</label></td> 
                            <td><input tabindex="8" title="How tall is this item? (Unit is unknown)" type="text" name="top" id="top" value="0.00" class="scanclass"></td> 
                        </tr> 
                        
                        <tr> 
                            <td><label for="cctname">CCT Name:</label></td> 
                            <td><input tabindex="9" type="text" name="cctname" id="cctname" class="scanclass"></td> 
                        </tr> 
                        <tr>
                        <td><label for="color">Color:</label></td>
                        <td><input tabindex="10" type="text" name="color" id="color" value="0,0,0" class="scanclass" /></td>
                        </tr>
                        
                        <tr> 
                            <td><label for="catidpage">Catalogue ID Page:</label></td> 
                            <td><input tabindex="11" type="text" name="catidpage" id="catidpage" class="scanclass"></td> 
                        </tr>
                        <tr> 
                            <td><label for="t">Tradable:</label></td> 
                            <td><input tabindex="12" title="Is this item allowed to be traded?" type="checkbox" name="t" id="t" value="1" class="scanclass" checked></td> 
                        </tr> 
                        <tr> 
                            <td><label for="r">Recyclable:</label></td> 
                            <td><input tabindex="13" title="Is this item allowed to be recycled?" type="checkbox" name="r" id="r" value="1" class="scanclass" checked></td> 
                        </tr>
                        <tr> 
                            <td><label for="d">Door:</label></td> 
                            <td><input tabindex="14" title="Is this item a door?" type="checkbox" name="d" id="d" value="0" class="scanclass"></td> 
                        </tr>
                        <tr> 
                            <td><input tabindex="15" title="If you are satisfied with the details you have provided, click this button!" type="submit" value="Create SQL Syntax!" name="sql_make" class="scanclass"></td> 
                            <td></td> 
                        </tr> 
                    </tbody> 
                </table> 
            </form> 
        </div> 
        <div name="results" id="results"> 
            <div style="text-align: center"> 
                <?php 
                if(isset($_POST['sql_make'])){ 
                    $tid = strip_tags(stripslashes($_POST['tid'])); 
                    $cctname = strip_tags(stripslashes($_POST['cctname'])); 
					$catname = strip_tags(stripslashes($_POST['cat_name']));
					$catdesc = strip_tags(stripslashes($_POST['cat_desc']));
                    $catidpage = strip_tags(stripslashes($_POST['catidpage'])); 
                    $cost = strip_tags(stripslashes($_POST['cost']));  
                    $top = strip_tags(stripslashes($_POST['top'])); 
                    $type = strip_tags(stripslashes($_POST['type']));
					$length = strip_tags(stripslashes($_POST['length']));
					$width = strip_tags(stripslashes($_POST['width']));
					$color = strip_tags(stripslashes($_POST['color']));
                    $error = ''; 
                    if($_POST['t'] == '1'){ 
                        $t = '1'; 
                    }else{ 
                        $t = '0'; 
                    } 
                    if($_POST['r'] == '1'){ 
                        $r = '1'; 
                    }else{ 
                        $r = '0'; 
                    } 
                    if($_POST['d'] == '1'){ 
                        $d = '1'; 
                    }else{ 
                        $d = '0'; 
                    } 
                    if(!$tid || !$cat_name || !$cat_desc || !$cost || !$cctname || !$catidpage || !$top || !$length || !$width || !$type || !$color|| !$drink){ 
                        $error .= '<li>All fields are required.</li>'; 
                    }else{ 
                        if(is_numeric($cost) == false){ 
                            $error .= '<li>The cost of credits must be numeric!</li>'; 
                        }else{ 
                            if(is_numeric($length) == false){ 
                                $error .= '<li>The length must be numeric!</li>'; 
                            }else{
								if(is_numeric($width) == false){
									$error .='<li>The width must be numeric!</lt>';
								}
							}
                        } 
                    } 
                    if(!$error){ 
                        $sql_mysql = "INSERT INTO `catalogue_items` (`tid`, `catalogue_name`, `catalogue_desc`, `catalogue_cost`, `typeid`, `length`, `width`, `top`, `name_cct`, `colour`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `picture`, `catalogue_id_index`) VALUES ('".$tid."', '".$catname."', '".$catdesc."', '".$cost."', '".$type."', '".$length."', '".$width."', '".$top."', '".$cctname."', '".$color."', '".$catidpage."', '".$d."', '".$t."', '".$r."', 'placeholder.gif', '".$tid."')"; 
                        $sql_php = "<?php mysql_query(\"INSERT INTO `catalogue_items` (`tid`, `catalogue_name`, `catalogue_desc`, `catalogue_cost`, `typeid`, `length`, `width`, `top`, `name_cct`, `colour`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `picture`, `catalogue_id_index`) VALUES ('".$tid."', '".$catname."', '".$catdesc."', '".$cost."', '".$type."', '".$length."', '".$width."', '".$top."', '".$cctname."', '".$color."', '".$catidpage."', '".$d."', '".$t."', '".$r."', 'placeholder.gif', '".$tid."')\"); ?>"; 
                        echo '<strong><u>Results</u></strong><br><br> 
                         
                        <strong>MySQL Query Code:</strong><br> 
                        <textarea class="scanclass" name="sql_mysql" id="sql_mysql" style="width:100%;" onclick="sel(\'sql_mysql\');" readonly>'.$sql_mysql.'</textarea> 
                         
                        <br><br> 
                         
                        <strong>PHP Query Code:</strong><br> 
                        <textarea class="scanclass" name="sql_php" id="sql_php" style="width:100%;" onclick="sel(\'sql_php\');" readonly>'.$sql_php.'</textarea>'; 
                    }else{ 
                        echo 'Sorry, we could not generate your SQL Syntax as the following error(s) occurred:<ul>'.$error.'</ul>'; 
                    } 
                } 
                ?> 
            </div> 
        </div> 
    </div> 
    <div> 
        <center> 
            <i>© Mark Eriksson 2010.<br>Coding and programming by Mark Eriksson (m0nsta./markeriksson94/iiM4RKx (same person)).<br>I'm not sure who did the design, but credits to them.<br>Click <strong><a href="mailto:[email protected]">here</a></strong> to send me an e-mail.<br>Click <strong><a href="javascript:moreCreditsAndStuffLikeThat();">here</a></strong> for more information on this product.</i> 
      </center> 
    </div> 
    </body>
</html>


Thanks so much mate! :):
 
'What?' I tried the v26 version I get these errors:

Notice: Undefined index: d in /home/royalnet/public_html/sql.php on line 126

Notice: Undefined variable: cat_name in /home/royalnet/public_html/sql.php on line 131
Sorry, we could not generate your SQL Syntax as the following error(s) occurred:

* All fields are required.

@MDK - No problem man :-). Glad you like it.
 
Status
Not open for further replies.
Back