simplypixie 123 Posting Pro in Training

In lines 229 and 235 you have forgotten the <?php endif; ?> (added below)

<div id="excerpt">
        <div>
            <p><span id="label"><b>Excerpt:</b></span>
            <div style="float:left;">
                <div><?php if(!empty($item->fields_by_id[32])):?><?php echo $item->fields_by_id[32]->result; ?><?php endif; ?></div>
            </div>
        </div>
    </div>

    <div id="memreview">
        <div><?php if(!empty($item->fields_by_id[14])):?><?php echo $item->fields_by_id[14]->result; ?><?php endif; ?></div>
    </div>

I have also noticed that you have some extra opening and closing tags in lines 145 to 150:

<div class="page-header">
                <<?php echo $params->get('tmpl_params.title_tag', 'h1')?>>
                    <?php echo $item->title?>
                    <?php echo CEventsHelper::showNum('record', $item->id);?>
                </<?php echo $params->get('tmpl_params.title_tag', 'h1')?>>
            </div>
simplypixie 123 Posting Pro in Training

I didn't tell you to use if(file_exists($uploadFilename)) I said use if (!empty($_FILES))

So all you should need to do to allow the form to be submitted without an image is change your if statement if (!is_uploaded_file($_FILES[$fieldname]['tmp_name'])) to if (!empty($_FILES)) and inside the if statement run all your checks on image type, reformatting and resizing etc and just ensure that the rest of the form posted data and your insert / update is outside of this if statement.

Your code could actually be much more simple as well and I was going to post what I use but at the moment I combine it with jquery and ajax so would just confuse you more, however a quick search gave me this page which might help you

simplypixie 123 Posting Pro in Training

Just wrap your code in an if statement and if there is a file it will run the image processing, otherwise it will just ignore it (then load your default image on the front end)

 if (!empty($_FILES)) {

 }

In fact this should replace your current if statement

simplypixie 123 Posting Pro in Training

SOrry I missed that in your original post.

Firstly I need to suugest that you immediately start ysing mysqli or PDO instead of just mysql as it is now depricated and much less secure than the other two (See Here).
Secondly, you only need to use hostname='', database_name='' etc if using PDO, if just using mysql (or mysqli - just change to mysqli) your database connection should just be:

$marketbase = mysql_connect("hostname","username","password","database") or die("Error " . mysql_error($marketbase));
simplypixie 123 Posting Pro in Training

What is on line 94?

simplypixie 123 Posting Pro in Training

That would be because you don't have 'pay' in your url so the $_GET['pay'] is empty as it doesn't exist. I don't see why it is needed so just remove that line.

simplypixie 123 Posting Pro in Training

Looking again, your $submit variables are incorrect, they should be $p and no qutore marks are required. I have amended my post above to correct those ares

simplypixie 123 Posting Pro in Training

You are missing ending semi-colons on some of your lines and also not closing your " on your echos

$p = $h * $r;
echo  "Your Weekly Salary Is: ".$p;



$p = ($h * $r) + (($h - 40) * $r * 1.5);
    echo "Your Weekly Salary Is: ".$p;
simplypixie 123 Posting Pro in Training

Sorry I missed a bit when checking if a div needs closing

<?php
  $count++;
  if ($count %3 == 0 || $count == $num_images) {
?>
  </div>
<?php  } ?>
simplypixie 123 Posting Pro in Training

OK, starting with the PHP you need to count the images and then check if you need to create a new row (i.e. after every 3 images).

<?php
  $count = 0;
  $num_images = mysql_num_rows($rs);
  while($data = mysql_fetch_assoc($rs)) {
?>
<?php if ($count == 0 || ($count %3 == 0 && $count < $num_images)) { ?>
  <div class="row">
<?php } ?>
  <span>
    <a href="details.php?pic=<? echo $data['id']; ?>">
      <img class="index_pic" width="200" height="200" src="pictures/thumbs/<? echo $data['thumb']; ?>" />
    </a><br>
    <? echo $data['user']; ?>----------- <? echo $data['views']; ?><img src="images/icon_view.gif" />
  <span>
<?php
  $count++;
  if ($count %3 == 0) {
?>
  </div>
<?php  } ?>

The %3 == 0 means if the $count divided by 3 leaves a difference of 0 then you have displayed 3 images in a row and it is time to start a new row.

Then you need to add come CSS to style the row class to ensure it is displayed underneath each time (not sure what CSS you have so can't advise very well, but):

.row {
  width: 100%;
  display: block;
}
simplypixie 123 Posting Pro in Training

Do you want the number of columns to be set or to be determined by the width available on the screen?

simplypixie 123 Posting Pro in Training

No problem, glad I could help. Please mark as solved :)

simplypixie 123 Posting Pro in Training

What about trying your query like this (I have removed the NULL values as they are not required for your id column)

if($_POST["Submit"]=="Submit"){ 
        mysql_query("INSERT INTO tblUser VALUES ('$fname', '$lname')"); 
        $new_id = mysql_insert_id();
        for ($i=0; $i<sizeof($checkbox);$i++){ 
        $sql2=mysql_query("INSERT INTO tblItems VALUES ('".$checkbox[$i]."', '$new_id')"); 
        } 
    }
simplypixie 123 Posting Pro in Training

In which case your echo statement is incorrect, try

$ss = $_POST['qty'];
echo "<div id='dialog01' title='ccc'>".$ss."</div>";
simplypixie 123 Posting Pro in Training

$_post is incorrect as always needs to be in upper case so change to $_POST

simplypixie 123 Posting Pro in Training

Works fine for me - are you sure you just have the navigation in your external file, like this?

<div class='navi'>

<ul class='item'>
<li><a href=''>Birthday</a></li>
<li><a href=''>New Baby</a></li>
<li><a href=''>Anniversary</a></li>
<li><a href=''>Wedding</a></li>
<li><a href=''>Driving Test</a></li>
<li><a href=''>Moving</a></li>
<li><a href=''>New Job</a></li>
<li><a href=''>Retirement</a></li>
<li><a href=''>Good Luck</a></li>
<li><a href=''>Engagement</a></li>
</ul>

</div>
simplypixie 123 Posting Pro in Training

If I understand correctly what you are trying to do, why on earth do you have 2 separate databases for your albums and images rather than 2 tables in one database?? There are other errors in your code, firstly $images[$i] = $row[0]; which will just keep populating your images array with the first result from your query results as you only ever assing the value at position 0. Secondly you cannot use table names like FROM $images[$q] as that would try and select from a table called, for example, FROM tablename[0] and as you cannot name tables like that, it just won't work.

What I suggest is chaning your db structure to one database with all your required tables and then you have 2 options to get your albums and related photos. The first is to run a nested query and while loop:

<?php 
    $con = mysql_connect("localhost","root","");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

mysql_select_db("new_db_name", $con);

$query="SELECT id, album FROM albumname ORDER BY RAND() LIMIT 9";

$result= mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)){
    $query2="SELECT Location FROM photos WHERE id='".$row['id']."'";
    $result2 = mysql_query($query2) or die(mysql_error());
    echo $row['album'].'<br>';
    while ($row2 = mysql_fetch_array($result2)) {
      echo $row2['Location'].'<br>';
    }
}

mysql_close($con);

?>

The second way is to use a join but may confuse you even more at the moment so I will leave it to you to decide and look into further if you wish.

simplypixie 123 Posting Pro in Training

I am very confused by your post and am thinking that what I am about to reply is incorrect as seems too simple, but here we go anyway just in case:

SELECT * FROM table_name WHERE pos_id NOT IN (SELECT pos_id FROM position_table)
simplypixie 123 Posting Pro in Training

The CSS I gave you for box-sizing is supposed to be at the top of your CSS on its own, not in one of your other divs (which is why it has the star, not a div name as it is to apply to everything in the website) so take it out of #content.

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
color:#414141
}

/* The rest of your CSS here
simplypixie 123 Posting Pro in Training

As GliderPilot says - however, just to clarify as well, the error you are getting is telling you that $subcategory (in your query) is either empty or in an incorrect format.

Where is the value assigend to $subcategory coming from (I don't see anything in your code where a value is assigned to this variable)? I am presuming you are posting the value from a form therefore you need to be using $_POST to obtain the data (for example - please adjust to match your form / variable name):

if (isset($_POST) && !empty($_POST['subcategory']) {
  $subcategory = $_POST['subcategory'];

  // Do rest of query here

}
simplypixie 123 Posting Pro in Training

To keep it really simple (unless I am missing something), you could just use

SELECT * FROM trans_table WHERE from_id NOT IN (SELECT mem_id FROM position_table)
simplypixie 123 Posting Pro in Training

Can you give us a link to the page in question?

simplypixie 123 Posting Pro in Training

Have you actually tried what I suggested as the issue of padding, margins and borders being added to a div width only happens in Firefox and Chrome?

Also, you haven't got any padding, margins or borders combined with width of 100% on your header, navigation or footer as you say you have, what you have is outer containers (i.e. #navigationwrap) with a width of 100% and the margin, padding and border applied to the inner container (i.e. #navigation), this is not the same as having one div (as in your #content) that has all of these elements and therefore adds all the 'widths' together to form an overall width.

simplypixie 123 Posting Pro in Training

It is due to the fact that padding, borders and margins all add to the overall width of the div they are applied to (if you remove all these elements from your content div you will see what I mean). One solution is to add this to the top of your stylesheet (I am not saying this is the correct thing to do)

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

Otherwise you need to calculate your margins, borders and padding as percentages and reduce the overall width of the div by the total of these percentages.

simplypixie 123 Posting Pro in Training

It cannot be anything to do with the code on your receiving page as the error is Undefined Index, meaning the variable $salesimage has received no value (no data has been posted for the image), and this has been confirmed by you printing out the file array and it being empty.

I have just noticed that you have no action defined in your opening form tag so how are you actually sending the form data to the script?? Change it to

<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">

And see if that helps. If not then I have no other solutions or suggestions apart from stripping all the other form elements and php out apart from those elements related to the file upload and see if it works then and if so, slowly add bits back in to find what is causing the issue.

simplypixie 123 Posting Pro in Training

Having that empty array means that the image is not being passed through with the form, maybe the file size is too big or there is some other error with the file (have you got any checks in place for situations like this)?

simplypixie 123 Posting Pro in Training

What exactly prints out, please post here (is it just an empty array?)

simplypixie 123 Posting Pro in Training

Have you tried this to ensure you are getting the data passed through?

print "<pre>";
print_r($_FILES);
print "</pre>";
simplypixie 123 Posting Pro in Training

Yes this is all fine

simplypixie 123 Posting Pro in Training

Unless you are assigning the $_POST['main_category'] to a variable called $main_category_p somewhere that we can't see, then you won't get anything echo'd out. You either need to assign the posted value to your new variable $main_category_p = $_POST['main_category'];or you should be using

if($_POST['main_category'] == "Choose..."){ $_POST['main_category'] = ""; }
echo "$_POST['main_category']";
simplypixie 123 Posting Pro in Training

Glad I could help, but please mark as Solved.

simplypixie 123 Posting Pro in Training

@blocblue - I wouldn't but the OP wanted to know how to do sub-queries as hasn't learnt about joins yet and I am just trying to help them do what they want to do at the moment (espeically if they can't do a sub-query yet then they are really going to struggle with joins).

simplypixie 123 Posting Pro in Training

If you really want to use sub-queries, and presuming you want to show all posts by each user, then this is the sort of thing you will need (I don't know how you want to layout on the page or what your columns are named in your table so have guessed and you will have to adjust accordingly)

$sq= mysql_query("SELECT user_id, username FROM users");

while ($user = mysql_fetch_array($sq)) {
    $sq2 = mysql_query("SELECT * FROM posts WHERE user_id='".$user['user_id']."'");

    echo '<p>'.$user['username'].'</p>';

    while ($posts = mysql_fetch_array($sq2)) {
        echo '<p>'.$posts['title'].'</p>';
        echo '<p>'.$posts['content'].'</p>';
    }
}

If you want to only pull users that actually have posts then combine what you already have with what I have put

$sq= mysql_query("SELECT user_id, username FROM users WHERE user_id IN (SELECT user_id FROM posts)");
simplypixie 123 Posting Pro in Training

shahai.ali - I presumed that was what it is for and if it is set to auto-increment you don't need to include any reference to it in your insert query, the database will automatically add the id for you. Have you actully tried the new code??

diafol - indeed, good advice!

simplypixie 123 Posting Pro in Training

Try this correction to your code (not sure what the NULL is for in your query and so have removed, I have also guessed at the field name in your table):

$fileName =  $_FILES["f_name"]["name"];
            $path = "uploads/" . $filename;         
            }
            mysql_query("INSERT INTO mytable file_path VALUES ('".$path."')") or die(mysql_error());
simplypixie 123 Posting Pro in Training

Why on earth do you want to store someone's password in a session - no need and very insecure???

Regardless of this, your login is obviously working as you get redirected as per your code, but the username stored in the session is incorrect, nowhere in your script have you set a variable $username, you have only set $username_p, therefore your $_SESSION['username'] = $username will never be populated with any information as it should be $_SESSION['username'] = $username_p.

As a side note, your are duplicating the PHP to check if a user is logged in (it is in both your header file and your index file, which already includes the information from your header file).

simplypixie 123 Posting Pro in Training

Looking at what you have in the other preg_replace functions, shouldn't #[^0-9#]i actually be #[^0-9]#i

With regard to your include files, that is down to you to check the paths to the files are correct I am afraid.

As for the mysql_num_rows issue, your query will presumably not work until you have resolved the preg_replace issue.

simplypixie 123 Posting Pro in Training

You need to learn responsive design / development if you want your site to work on mobile.

simplypixie 123 Posting Pro in Training

Further to diafol's advice, in your current code, you have a lot wrong. This is what is should be (based on what you have already) - please compare this code to what you have to see your mistakes:

<!-- <form action="ContactUs.php" method="POST"> this shouldn't be here -->
<?php
if (isset($_POST)) {
    $firstname = $_POST['fname'];
    $products = $_POST['products'];
    $email = $_POST['email'];
    if (isset($firstname) && isset($email) && isset($products)) {
        echo "Thank you ".$firstname." for interest in ".$products.". We will contact you soon.";      
    } else {
        echo "Please complete the form correctly";
    }
}
?>

This is a vary basic example for you using your existing code, please combine with diafol's advice above.

simplypixie 123 Posting Pro in Training

This is wrong:

        <option value= '1' <?php echo $cat_row->country_id; ?> >

It should be:

        <option value= "<?php echo $cat_row->country_id; ?>" >
simplypixie 123 Posting Pro in Training
if (isset($_GET['start'])) {
  $start=$_GET['start'];
}

Read this article to help further.

simplypixie 123 Posting Pro in Training

What you are currently doing is trying to find records where year = '2012, 2011, 201, 2009, 2008' and I would think that you don't have a value like that in your database. I presume you are trying to see if a year matches ONE of the years in your array, in which case do this:

$result = mysql_query("SELECT * FROM VehicleYearModel WHERE year IN ($matches)");
simplypixie 123 Posting Pro in Training

Formatting on here is no different to any other forum, just type in the box and when you want to display code, hit the Code link, put in the code and click the Insert Code button.

As for your problem, try this:

SELECT count(*) from Inquiry 
Inner Join Inquirer on Inquirer.ID = Inquiry.InquirerID_fk
WHERE Inquirer.Program = 'value' AND Inquiry.ID 
not in (SELECT TransferInquiryID_fk from Transfer)
simplypixie 123 Posting Pro in Training

Like this:

<input type="radio" name="type" value="Student" <?php if ($type=='Student') { echo 'checked'; } ?> /> Student<br />
<input type="radio" name="type" value="Teacher" <?php if ($type=='Teacher') { echo 'checked'; } ?> /> Teacher<br />
simplypixie 123 Posting Pro in Training

I am wondering if your name="type" is causing a conflict as type is used as part of a form elements details. Have you tried changing it to something else and see what happens?

Also, are you sure that one of the radio buttons is being selected?

simplypixie 123 Posting Pro in Training

As I put in my original post!

Djmann1013 commented: Thanks +1
simplypixie 123 Posting Pro in Training

I stand corrected - but, I have never once, in all my learning over the years, come across any PHP code that uses the actual words 'and' or 'or' instead of '&&' or '||'

simplypixie 123 Posting Pro in Training

rotten69 didn't change your code for the OR, you cannot use OR in PHP, only in sql queries. So it should be

if($row['banned'] == 1 || $row['banned'] == 2) {
  header ('location: url');
}

You don't need speach marks around numbers/integers as suggested earlier either.

Have you echo'd $row['banned'] to ensure you actually have a value coming from the database?

Also what happens if they aren't banned, surely you should have an else statement following your if for cases like that?

simplypixie 123 Posting Pro in Training

That makes no difference, you just change the action in the form to submit to the same page (or whichever page your php script is on) - it has nothing to do with the radio buttons.

simplypixie 123 Posting Pro in Training

Firslty, name each radio button the same and then give each one a different value:

<input type="radio" name="radio_name" value="radio_value1" />
<input type="radio" name="radio_name" value="radio_value2" />
// And so on

Then for the PHP you just need to get the value based on the name:

$radio_value = $_POST['radio_name'];

Obviously change the values in the name and value elements of the radio buttons (and the name of the PHP variable) to what you need them to be.