BloodyMind
-
Posts
98 -
Joined
-
Last visited
Never
Posts posted by BloodyMind
-
-
try to explain more, do u want to compare those arrays on what condition ? values in the database or what
coz the socks as a string has nothing to do with five dollars, if you want to merge them, you can do it with a loop
make an empty array and foreach through both arrays so it inserts key and value into the new array
-
you can serialize it use serialize() and when calling unserialize() easier to handle arrays in different environments, I didn't understand what u wanted to do anyways but it's all fine lol
-
I use Zend Studio but not sure there is a version for Mac there is one of Linux and MS Windows
It's so helpful auto complete, instant call to php manual to search for a php function
and u can ctrl+click on a function call, then it links to the resource of the function pretty brilliant,
it doesn't support smarty nor Javascript but I guess they have fixed that in the 6.1, don't download version 6.0 it has got a bug in the smarty templates which u might wanna use after sometime
'PHP Designer' is also good for a beginning
wish u good luck
-
I've got a problem in this http headers, maybe in the filename or path I've tried alot but no joy
this script is to get the filename from the database and set the path to it so it gets downloaded.
getfile.php:
<?php if(is_numeric($_GET['fid'])){ $dirs = new Directories($db['host'],$db['username'],$db['password'],$db['name']); $fileId = $_GET['fid']; $rows = $dirs->getFile($fileId); if (!is_array($rows)) { echo $row; } foreach ($rows as $files){ $file = urldecode($files['file_name']); } $file = urldecode($file); $file_size = filesize(realpath($file)); $file = urlencode(basename($file)); $file = basename($file); // $final_file = urlencode(USER_UPLOADS . "/" .$file); $final_file = $file; if (!is_file($final_file)) { echo $final_file; } header("Content-length: {$file_size}"); header("Content-disposition: attachment; filename= '$final_file'"); header("Content-type: image/jpg"); header("Content-Description: Project File"); } ?>
What this script does?
It downloads a file with the same name but, 0 bytes
any kind of help will be so appreciated
Thank you
-
just look the code in the first post, to see the full picture
first I pass the input name to the add project function, then it is passed to the static function Handles::uploadHandle()
but I get an empty $_FILES array.... and that notice up there
thanks again
-
Why don't you guys click on solved at the bottom of the screen so you can give some space to the unsolved problems and inform ppl
thanks
-
I did it's the last one "$in_imageFieldName" the value I passed to it is proImage
-
Could it be, that gebruikt = 1 only where currency is EUR? Other than that I can not see anything that would limit the query.
And yes, MySQL does support foreign keys since ver. 3.22.34
edit
Why are you using
logindb.product_link = orderdb.id
instead of
logindb.orderlink = orderdb.id
?
Indeed just use InnoDB Engine so it supports transactions
-
breifly:
<?php // upload form ?> <form method="post" action="<?php echo BASE_URL; ?>/admin/add-project.php"> <input name="proImage" type="file" id="proImage" /> </form> <?php // it gives me the notice here that the field name is undefined if (is_uploaded_file($_FILES['proImage']['tmp_name'])) { $uploadedImage = Handles::uploadHandle('proImage',PROIMG_DIR,'Please upload a valid image file'); }
-
Hello there mates,
need your help about a little bit stupid problem but I have no clue what's happening
I've got an image file in my form, but it gives me a notice
Notice: Undefined index: proImage in xxx\bizlogic\projects.class.php on line 83
add-project.php:
<?php require_once('../bizlogic/projects.class.php'); require_once('../bizlogic/verifier.class.php'); require_once('../bizlogic/gp.class.php'); $title = 'Catalyst Admin | Add Project'; $base_url = BASE_URL; $addHeader = <<<EOHEAD <!-- TinyMCE --> <script type="text/javascript" src="$base_url/tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "simple", plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "tinymce/css/content.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "tinymce/lists/template_list.js", external_link_list_url : "tinymce/lists/link_list.js", external_image_list_url : "tinymce/lists/image_list.js", media_external_list_url : "tinymce/lists/media_list.js", // Replace values for the template plugin template_replace_values : { username : "catalyst", staffid : "9912344" } }); </script> EOHEAD; $projects = new projects($db['host'],$db['username'],$db['password'],$db['name']); $rows = $projects->getAllCategories(); if (!is_array($rows)) { echo $rows; die(); } if ($_POST['submit'] == "Submit") { $cat_id = $_POST['category']; $title = $_POST['title']; $name = $_POST['proName']; $proDesc = $_POST['description']; $owner = $_POST['owner']; $typeOwork = $_POST['typeOwork']; $city = $_POST['city']; $state = $_POST['state']; $value = $_POST['provalue']; $attach = $_POST['attach']; var_dump($_FILES); $feedback = $projects->addProject($cat_id,$title,$name,$proDesc,$owner,$typeOwork,$attach, $city,$state,$value,'proImage'); if ($feedback !== TRUE) { echo $feedback; die(); } } include_once('../includes/header.inc.php'); include_once('../includes/sidebar.inc.php'); ?> <h2>Add Project</h2> <br /> <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> <div> <form method="post" action="<?php echo BASE_URL; ?>/admin/add-project.php"> <table width="700" border="0" cellpadding="0" cellspacing="2" class="p"> <tr> <td width="110" class="p"><strong>Category</strong></td> <?php if ($feedback !== TRUE) { echo $feedback; } ?> <td width="584"><label> <select name="category" id="category" style="p"> <?php foreach ($rows as $row){ echo "<option value=" . $row['cat_id'] . ">" . $row['cat_title'] . "</option>\r\n"; } ?> </select> </label></td> <tr> <td class="p"><strong>Title </strong></td> <td width="584"><span class="p"> <input name="title" type="text" id="title" size="50" /> </span></td> </tr> <tr> <td width="110" class="p"><strong><span class="p">Name</span></strong></td> <td><span class="p"> <label> <input name="proName" type="text" id="textfield" size="50" /> </label> </span></td> </tr> <tr> <td valign="top" class="p"><strong><span class="p">Description </span></strong></td> <td><span class="p"> <textarea id="description" name="description" rows="15" cols="50" style="width: 80%">Description Goes here </textarea> </span></td> </tr> <tr> <td class="p"><strong><span class="p">Owner</span></strong></td> <td><span class="p"> <label> <input name="owner" type="text" id="textfield2" size="40" /> </label> </span></td> </tr> <tr> <td class="p"><strong><span class="p">Type Of Work</span></strong></td> <td><span class="p"> <label> <input name="typeOwork" type="text" id="textfield3" size="40" /> </label> </span></td> </tr> <tr> <td class="p"><span class="p"><strong>City</strong></span></td> <td><span class="p"> <input name="city" type="text" id="city" size="20" /> </span></td> </tr> <tr> <td class="p"><span class="p"><strong>State</strong></span></td> <td><span class="p"> <label> <input name="state" type="text" id="state" size="20" /> </label> </span></td> </tr> <tr> <td class="p"><span class="p"><strong>Value</strong></span></td> <td><span class="p"> <label> <input name="provalue" type="text" id="value" size="20" /> </label> </span></td> </tr> <tr> <td class="p"><strong>Attachments</strong></td> <td><label> <input name="attach" type="checkbox" id="checkbox" value="1" /> </label></td> </tr> <tr> <td class="p"><strong>Image</strong></td> <td><label> <input name="proImage" type="file" id="proImage" /> </label></td> </tr> </table> <p> </p> <table width="700" border="0" cellpadding="1" cellspacing="0" class="p"> <tr> <td width="105"><strong>Files:</strong></td> <td width="591"> </td> </tr> <tr> <td> </td> <td width="591"><label> <input name="file1" type="file" id="file1" size="30" /> </label></td> </tr> <tr> <td> </td> <td width="591"><label> <input name="file2" type="file" id="file2" size="30" /> </label></td> </tr> <tr> <td> </td> <td width="591"><label> <input name="file3" type="file" id="file3" size="30" /> </label></td> </tr> <tr> <td> </td> <td width="591"><label> <input name="file4" type="file" id="file4" size="30" /> </label></td> </tr> <tr> <td> </td> <td width="591"><label> <input name="file5" type="file" id="file5" size="30" /> </label></td> </tr> </table> <p> <input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /> </p> </form> <p><span class="redTxT" >*Note: please attach the project's image with width NOT more than 750 pixels wide.</span></p> </div> <p> </p> <?php require_once("../includes/footer.inc.php"); ?>
Add Project Function:
<?php public function addProject ( $in_catId, $in_projectTitle, $in_projectName, $in_projectDescription, $in_owner, $in_typeOwork, $in_attachments=NULL, $in_city, $in_state, $in_value, $in_imageFieldName ){ try { if (empty($in_catId) or empty($in_projectTitle) or empty($in_projectDescription) or empty($in_city) or empty($in_state) or empty($in_value)) { throw new Exception('Please fill in all mandatory fields.'); } $projectTitle= Verifier::super_escape_string($in_projectTitle,$this->conn); $projectName = Verifier::validateName($in_projectName,'100','Project Name',$this->conn); $projectDescription = htmlentities($in_projectDescription); $owner = Verifier::validateName($in_owner,'100','Owner',$this->conn); $typeOwork = Verifier::validateName($in_typeOwork,'60','Type of Work',$this->conn); $city = Verifier::validateName($in_city,'60','City',$this->conn); $state = Verifier::validateName($in_state,'60','State',$this->conn); $value = Verifier::validateName($in_value,'60','Value',$this->conn); $image = null; if (is_uploaded_file($_FILES[$in_imageFieldName]['tmp_name'])) { $uploadedImage = Handles::uploadHandle('image',PROIMG_DIR,'Please upload a valid image file'); } // if there is a project image, upload it if (isset($uploadedImage)) { $image = basename($uploadedImage); $image = urlencode($image); echo $image; } // if there is attachments upload the files if ($in_attachments !== NULL) { $feed = $this->uploadFiles(); if ($feed!== TRUE) { throw new Exception($feed); } } $addsql = "INSERT INTO projects SET cat_id ='$in_catId',pro_title='$projectTitle',pro_name='$projectName' , pro_photo='$image', pro_desc='$projectDescription', owner='$owner', type_of_work = '$typeOwork', attachments='$in_attachments', city='$city', state='$state', value='$value' "; $results = $this->conn->query($addsql); if ($results == FALSE) { throw new Exception('Database Error: Cannot add project'); } return TRUE; }catch (Exception $e){ return $e->getMessage(); } } ?>
file handle here(Handles::uploadHandle()) :
/** * Verifies and uploads desired file * * @param string $in_inputeName input name in post * @param string $in_dir desired directory to upload to * @param string $err_str error msg to catch if error occured * @return string $fileupload path/filename.ext to the uploaded file */ static function uploadHandle($in_inputeName,$in_dir,$err_str){ $blacklist = array(".php", ".phtml", ".php3", ".php4",".txt"); foreach ($blacklist as $item) { if(preg_match("/$item\$/i", $_FILES[$in_inputeName]['name'])) { throw new Exception("We do not allow uploading PHP files\n"); } } // UPLOAD_ERR_OK is file transfered successfully. if ($_FILES[$in_inputeName]['error'] !== UPLOAD_ERR_OK){ throw new Exception($err_str); } $fileupload = $in_dir . basename($_FILES[$in_inputeName]['name']); if (!move_uploaded_file($_FILES[$in_inputeName]['tmp_name'],$fileupload)) { throw new Exception($err_str); } return $fileupload; } }
Constants:
<?php define('DIR_PATH','C:/xampp/htdocs/catalyst'); define('PROIMG_DIR',DIR_PATH . '/uploads/projectImg/'); ?>
by the way, I've tried to var_dump($_FILES) it returned and empty array
Thanks in advance
-
still didn't work
here is my new CSS:
@charset "utf-8"; body { /*font: 100% Verdana, Arial, Helvetica, sans-serif;*/ font-family:Arial, Helvetica, sans-serif; background: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #000000; } body .p{ color:#000; font-family:Arial, Helvetica, sans-serif; text-align: left; font-size: 14px; } #bridge-content{ width:auto; right:inher; position:relative; } #catalyst-01{ height:250px; } select{ width:200px; } #mainContent a,a:link,a:visited,a:active{ color:#00C; border-bottom-style:solid; border-bottom-width:thin; text-decoration:underline; border-bottom: 1px #FFF; } #mainContent a:hover { color: #009; text-decoration: none; } /*img, a img { border: 0;}*/ img { border:thin; border-color:#333; border-style:groove; text-align: right; } .redTxT{ color:#F00; font-weight:bold; } .p { color:#000; font-family:Arial, Helvetica, sans-serif; text-align: left; font-size: 14px; } .catalyst{ color:#006; font-weight:bold; } #footer a,a:link,a:visited,a:active{ color:#FFF; text-decoration: none; font-family: Verdana, Geneva, sans-serif; } #footer a:hover{ color: #ccc; border-bottom: 1px #FFF; border-bottom-style:groove; font-family: Verdana, Geneva, sans-serif; } .buttomLinks{ color:#FFF; font-family: Verdana, Geneva, sans-serif; font-size: 10px; } .twoColFixLtHdr #container { width: 1000px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */ background: #FFFFFF; /* the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; } .twoColFixLtHdr #sidebar1 { float: left; /* since this element is floated, a width must be given */ width: 200px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */ background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */ padding: 15px 10px 15px 20px; text-align: center; z-index: 2; height:100%; } .twoColFixLtHdr #mainContent { margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */ padding: 0 10px; /* remember that padding is the space inside the div box and margin is the space outside the div box */ margin-top: 0px; background-image:url(images/wm.jpg); text-align: left; } .twoColFixLtHdr #wrapper { overflow: hidden; width: 1000px; margin:inherit; } .twoColFixLtHdr #header { background: #DDDDDD; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */ } .twoColFixLtHdr #header h1 { margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */ padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ text-align: justify; } .twoColFixLtHdr #mainContent h2 { color:#006; font-family:Arial, Helvetica, sans-serif; letter-spacing:5; } .twoColFixLtHdr #mainContent h4 { color:#930; font-family:Arial, Helvetica, sans-serif; letter-spacing:5; } .twoColFixLtHdr #footer { padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ background:#DDDDDD; background-image: url(images/footer-bg.png); height:auto; z-index: 1; } .twoColFixLtHdr #footer p { margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ text-align: center; color: #FFF; } .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear:both; height:0; font-size: 1px; line-height: 0px; } .twoColFixLtHdr #container #mainContent h1 { text-align: center; color:#006; } .twoColFixLtHdr #container #mainContent h2 { text-align: center; color:#006; letter-spacing:2; } .twoColFixLtHdr #topTabs #mainContent{ position:relative; margin-left:auto; width:600px; height:21px; z-index:2; text-align: center; background-color:#FFF; color:#000; font-family:Arial, Helvetica, sans-serif; visibility: inherit; } descCell{ padding:10px; } .filestbl{ border:thin; border-color:#666; border-style:solid; } #mainContentNoSide a,a:link,a:visited,a:active{ color:#00C; border-bottom-style:solid; border-bottom-width:thin; text-decoration:underline; border-bottom: 1px #FFF; } #mainContentNoSide a:hover { color: #009; text-decoration: none; } .twoColFixLtHdr #mainContentNoSide { /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */ padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */ margin-top: 0px; background-image:url(images/wm.jpg); text-align: left; } .twoColFixLtHdr #container #mainContentNoSide h1 { text-align: center; color:#006; } .twoColFixLtHdr #container #mainContentNoSide h2 { text-align: center; color:#006; letter-spacing:2; } .tabPage #mainContentNoSide .tabPage ul li { text-align: left; } .tabPage #mainContentNoSide .p h3 { text-align: center; color:#006; } .twoColFixLtHdr #container #mainContentNoSide h3 { text-align: center; color:#006; } .twoColFixLtHdr #container #mainContentNoSide #contact tr td u { font-size: 18px; } /* ----------------------------------------------TABS STYLE ---------------------------*/ .innerContent{ padding:5px; margin-left: 10px; } tabWrapper{ } div.tabMain { background-color: #c0c0c0; border: 1px solid #000000; padding: 1px; position: relative; z-index: 101; width:680px; height:inherit; } .tabPage{ background-color:#FFF; width:700; color:#000; left:15px; font-family:Arial, Helvetica, sans-serif; } div.tabArea { font-size: 80%; font-weight: bold; text-align: left; position:relative; left:0px; } a.tab { background-color: #f0f0f0; border: 1px solid #000000; border-bottom-width: 0px; padding: 2px 1em 2px 1em; position: relative; text-decoration: none; top: -1px; z-index: 100; } a.tab, a.tab:visited { color: #808080 !important; } a.tab:hover { background-color: #CCC; color: #FFF !IMPORTANT; } a.tab.activeTab, a.tab.activeTab:hover, a.tab.activeTab:visited { background-color: #c0c0c0 !important; color: #000000; z-index: 102; } .tabMain iframe { text-align: center; } div.tabMain { background-color: #c0c0c0; border: 1px solid #000000; padding: 1em; } div.tabIframeWrapper { width: 100%; } iframe.tabContent { background-color: #FFF; border: 1px solid #000000; width: 100%; } .tabPage #mainContent .tabPage ul li { text-align: left; } .tabPage #mainContent .p h3 { text-align: center; color:#006; } .twoColFixLtHdr #container #mainContent h3 { text-align: center; color:#006; } .twoColFixLtHdr #container #mainContent #contact tr td u { font-size: 18px; } #contactForm { position:inherit; }.contacts { font-family: Arial, Helvetica, sans-serif; color: #009; } .textJustify { text-align: justify; }
-
please I have this 2 column fixed layout from templates of the dreamweaver
but I want the Sidebar height to be equal to the main content's height
in other words i want it to stretch till the footer
here is the layout: http://www.arwebgate.com/catalyst/testimonials.html
CSS:
@charset "utf-8"; body { /*font: 100% Verdana, Arial, Helvetica, sans-serif;*/ font-family:Arial, Helvetica, sans-serif; background: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #000000; } body .p{ color:#000; font-family:Arial, Helvetica, sans-serif; text-align: left; font-size: 14px; } #bridge-content{ width:auto; right:inher; position:relative; } #catalyst-01{ height:250px; } select{ width:200px; } #mainContent a,a:link,a:visited,a:active{ color:#00C; border-bottom-style:solid; border-bottom-width:thin; text-decoration:underline; border-bottom: 1px #FFF; } #mainContent a:hover { color: #009; text-decoration: none; } /*img, a img { border: 0;}*/ img { border:thin; border-color:#333; border-style:groove; text-align: right; } .redTxT{ color:#F00; font-weight:bold; } .p { color:#000; font-family:Arial, Helvetica, sans-serif; text-align: left; font-size: 14px; } .catalyst{ color:#006; font-weight:bold; } #footer a,a:link,a:visited,a:active{ color:#FFF; text-decoration: none; font-family: Verdana, Geneva, sans-serif; } #footer a:hover{ color: #ccc; border-bottom: 1px #FFF; border-bottom-style:groove; font-family: Verdana, Geneva, sans-serif; } .buttomLinks{ color:#FFF; font-family: Verdana, Geneva, sans-serif; font-size: 10px; } .twoColFixLtHdr #container { width: 1000px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */ background: #FFFFFF; /* the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; } .twoColFixLtHdr #innerContainer{ height:auto; margin-bottom: auto; } .twoColFixLtHdr #header { background: #DDDDDD; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */ } .twoColFixLtHdr #header h1 { margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */ padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ text-align: justify; } .twoColFixLtHdr #mainContent h2 { color:#006; font-family:Arial, Helvetica, sans-serif; letter-spacing:5; } .twoColFixLtHdr #sidebar1 { float: left; /* since this element is floated, a width must be given */ width: 200px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */ background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */ padding: 15px 10px 15px 20px; text-align: center; z-index: 2; height: 100%; } .twoColFixLtHdr #mainContent { margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */ padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */ margin-top: 0px; background-image:url(images/wm.jpg); text-align: left; } .twoColFixLtHdr #footer { padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ background:#DDDDDD; background-image: url(images/footer-bg.png); height:auto; z-index: 1; } .twoColFixLtHdr #footer p { margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ text-align: center; color: #FFF; } .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear:both; height:0; font-size: 1px; line-height: 0px; } .twoColFixLtHdr #container #mainContent h1 { text-align: center; color:#006; } .twoColFixLtHdr #container #mainContent h2 { text-align: center; color:#006; letter-spacing:2; } .twoColFixLtHdr #topTabs #mainContent{ position:relative; margin-left:auto; width:600px; height:21px; z-index:2; text-align: center; background-color:#FFF; color:#000; font-family:Arial, Helvetica, sans-serif; visibility: inherit; }
any help would be appreciated
thanks in advance
-
That solved the problem,
thanks alot mate, I really appreciate that
-
maybe you can try another SQL clause for joining tables
try left join for instance it maybe faster
-
please highlight the code by using the insert code in the upper panel
-
I'm using MySQLi
and it's working perfectly in the rest of the classes
there you go if that helps:
<?php private function getConnection(){ $this->conn = new mysqli($this->dbHost,$this->dbUser,$this->dbPass,$this->dbName); if (!$this->conn) { //throw new DatabaseConnectionErrorException(conn_connect_error()); trigger_error('cannot connect to db'); } return $this->conn; } ?>
-
What I'm trying to do is fetching project's details into a page, What I get is a record that has nothing to do with the ID i've requested the query to be done on, I've tried to execute the query on phpMyAdmin and it works perfectly,
Plus the results execute on the a line good and the other it doesn't I don't have any clue please professional help
here is the code:
Project's details page(project-details.php?pid=2):
<?php require_once('bizlogic/projects.class.php'); require_once('conf/conf.inc.php'); if (is_numeric($_GET['pid'])){ $project = new Projects($db['host'],$db['username'],$db['password'],$db['name']); $projectId = $_GET['pid']; $rows = $project->getProject($projectId); if (!is_array($rows)) { echo $rows; die(); } var_dump($rows); foreach($rows as $row){ $title = 'Catalyst Contractors Inc. | ' . $row['pro_name']; include_once('includes/header.inc.php'); //---------------this following line who is fucking up my life !!!! include_once('includes/sidebar.inc.php'); echo $row['pro_name'] . "<br />"; echo "<h4>" . $row['cat_title'] . ": </h4>"; echo "<table width=\"700\" height=\"248\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" id=\"proDetails\">"; echo "<tr>"; echo "<td colspan=\"2\" class=\"p\"><img src='" . PROIMG_URL . "/" . $row['pro_photo'] . "' alt='" . $row['pro_name'] . "' width=\"563\" height=\"375\" /></td>"; echo "</tr>"; echo "<tr>"; echo "<td width=\"118\" class=\"p\"><span class=\"p\"><strong>Project Name:</strong></span></td>"; echo "<td width=\"578\"><span class=\"p\">" . $row['pro_name'] . "</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"p\"><span class=\"p\"><strong>Location:</strong></span></td>"; echo "<td><span class=\"p\">" . $row['city'] . ", " . $row['state'] . "</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"p\"><span class=\"p\"><strong>Value: </strong></span></td>"; echo "<td><span class=\"p\">" . $row['value'] . "</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"p\"><span class=\"p\"><strong>Owner:</strong></span></td>"; echo "<td><span class=\"p\">" . $row['owner'] . "</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"p\"><span class=\"p\"><strong>Type of work:</strong></span></td>"; echo "<td><span class=\"p\">" . $row['type_of_work'] . "</span></td>"; echo "</tr>"; echo "<tr>"; $row['pro_desc'] = nl2br($row['pro_desc']); echo "<td colspan=\"2\" class=\"p descCell\"><p><span class=\"p\">" . $row['pro_desc'] . "</span></p></td>"; echo "</tr>"; echo "</table>"; } ?>
here is the code of the method from the class:
<?php public function getProject($in_ProjectId){ try { $projectId = intval($in_ProjectId); $getSQL = "SELECT * FROM projects p LEFT JOIN categories c ON p.cat_id = c.cat_id WHERE pro_id = '$projectId'"; $results = $this->conn->query($getSQL); if ($results == FALSE) { throw new Exception('Database Error: Cannot fetch project\'s data.'); } $rows = array(); while ($row = $results->fetch_assoc()){ $rows[] = $row; break; } return $rows; }catch (Exception $e){ return $e->getMessage(); } } ?>
sidebar.inc.php:
<?php <div id="sidebar1"> <div id="featuredproj"><img src="<?php echo BASE_URL; ?>/images/catalyst_07.jpg" alt="" name="featuredproj" width="152" height="16" id="catalyst_07" /><br /> </div> <br /> <div id="bridge"> <img id="catalyst_11" src="<?php echo BASE_URL; ?>/images/catalyst_11.jpg" width="188" height="64" alt="" /> </div> <br /> <table width="200" border="0" cellspacing="0" cellpadding="1" id="prodTable"> <?php $projects = new projects($db['host'],$db['username'],$db['password'],$db['name']); // 1. first SELECT categories $numOfCategories = $projects->getNumCategories(); for ($i=1;$i<=$numOfCategories;$i++){ $projectRows = $projects->getAllProjectsByCategory($i); if (!is_array($projectRows)) { echo $projectRows; die(); } echo "<tr>\r\n"; echo "<td valign='bottom' align='left'><strong>" . $projectRows[$i-1]['cat_title'] . ":</strong></td>"; echo "</tr>"; echo "<tr>"; echo "<td><form name='form' id='form'>"; echo "<select name=\"jumpMenu\" id=\"jumpMenu\" onchange=\"MM_jumpMenu('parent',this,0)\">"; echo "<option>Select Project</option>"; foreach ($projectRows as $row) { echo "<option value='project-details.php?pid=" . $row['pro_id'] . "'>" . $row['pro_title'] . "</option>"; } echo "</select>"; echo "<br /><br />"; echo "</form></td>"; echo "</tr>"; } ?> </table> <p> </p> <p> </p> </div> <!-- end #sidebar1 --> <!-- CONTENT --> <div id="mainContent"> ?>
I've finally had known that comes from the sidebar.inc.php but what has that to do with anything, I want to use the sidebar, why should the sidebar gets me another record from the database!!!!!
PS: I'm putting php tags at the beginning and the end of the page just to highlight the code but they don't exist in the real file
pleaaase anyone help!!
-
Mate,
here is the error: <form meathod="post"> it's supposed to be <form method="post" action="<?php echo $_SERVER['PHP_SELF]; ?>">
or make the action to the name of this file
hint: please try to use any IDE(Integrated Development Environment) ex: Zend Studio is brilliant
-
Hello there,
I just installed LAMP on Ubuntu 7.10
I'm a total noobie on linux
I have imported my database, my application and all
then when i try to simply access anything in the database with the user and pass I get this error
Access denied for user 'www-data'@'localhost' (using password: NO)
I have no idea about this user
anyone can help!
Thank you in advance
-
NO IT'S NOT
i've just got a little puzzled
anyone please HELP
-
The Problem solved
It was the WAMP Server was hallucinating I reinstalled it and it works just fine.
Thanx for trying to help and I have an advice for anyone who donesn't know it already
WAMP Server is just for learning purposes
but is XAMMP good?!!
-
yes I'm making error reporting E_ALL and display_errors is set to ON
but nothing happens!
-
I'm with u ACS
your code is totally unreadable
-
I have tested it and it's set with result:
mysqli Object ( )
but when i do print_r($results)
it does nothing at all
Mail Attatchments in a form (Error 500)
in PHP Coding Help
Posted
got you mate, are you on windows ? because windows implementation of MIME is different from *nix
because this happened to me once, it sends some random string instead of attachment or attach a 0 bytes file or a file with rand string