Will Gresham 81 Master Poster

Do you have phpMyAdmin?

If you do, copy the query from your script and run it directly in there.

You say 'It still didn't work', do you mean it does exactly the same, or are you getting additional/different errors after changing the code?

Will Gresham 81 Master Poster

PHP does not reference objects in that way.
$_POST is an array of the objects in the form (Inputs, Buttons, Selects etc..)
$_POST does not reference the form itself, so unless you have a field with the id form1, it will return a null value.

As above, use the ID of the button that is clicked in this statement:

if(isset($_POST['button_id']))
Will Gresham 81 Master Poster

It seems the search function on the site is broken.

If I enter a phrase in the search box, it does return results.
However, leave the box blank and click search to get the advanced options, and no matter what I put in, it came up with 'Sorry - no matches. Please try some different terms. '

Just to be sure, I entered the term php in the advanced search and selected the PHP forum, and again, no results.

Also, the dropdown to save/clear preferences always alerts 'Seach Preferences Saved' regardless of which option is chosen :)

Will Gresham 81 Master Poster

Rather than:

$data = mysqli_query($dbc, $query);

Try this:

if (!$data = mysqli_query($dbc, $query)) {
    printf("Error message: %s\n", mysqli_error($dbc));
}

It should throw an error in the SQL statement.

Will Gresham 81 Master Poster
$data = mysqli_query($dbc, $query);

Should this be:

$data = mysqli_query($query, $dbc);

Having not used mysqli - I can't comment, but I think the first parameter should be the query, then the connection link identifier.

Nope, for some reason they swapped them for mysqli, although if no connection is specified, it will default to that last connection that was established I believe. :)
http://www.php.net/manual/en/mysqli.query.php

diafol commented: Thanks Will - didn't know that +4
Will Gresham 81 Master Poster

Pizza :)

Will Gresham 81 Master Poster

Paypal has a whole section of their website dedicated to this subject, along with their own support forums. You will probably get all the info you need there :)

Will Gresham 81 Master Poster

So, anyone else watch this?

I am rather annoyed with one groups continued success so far, especially after they killed a Queen classic last night :(

Will Gresham 81 Master Poster

Ah, seems Dani's last tweet addresses the lack of online users:

DaniWeb: No longer calculating users online has reduced database load avg from 1.5 to 0.3 ... No longer stressing about db issues

Though, surely there would be a less resource hungry way to do it...

Will Gresham 81 Master Poster

You would probably be better asking this in the HTML/CSS forum: http://www.daniweb.com/forums/forum143.html

Will Gresham 81 Master Poster

Does it do anything?

Do you get a blank screen, an error?

Will Gresham 81 Master Poster

Is it just me, or has the 'Whos online' block disappeared from the end of the page as well?

Will Gresham 81 Master Poster

To add an item to an array, do this:

$array_name[] = 'Value';

Then to print out the entire array:

foreach($array_name as $key => $value) {
  echo $value . "<br />";
}

If that is not what you want then post an example of your code.

Will Gresham 81 Master Poster

As ardav said, you will need to use the API:
http://rapidshare.com/dev.html

Will Gresham 81 Master Poster

What is a netbook? Never heard of that. :)

They are the little 10/11 inch things, MSI Wind, Asus Eee, Medion E1210 and the likes :)

I find them fairly useless.

Just go to uni :P then its only $50 AUS

Or find a Uni that is a Microsoft Partner, then they are usually free :D

Will Gresham 81 Master Poster

I see,
Can you help me point out method names that you see will prevent reuse? I see that I should change all login prompts may be to use XML (is that what you said?). But I'm afraid I might forget some. So pointing methods that need to be removed/changed for sake of re-use will be great help to me.

Another thing is, I have not learned Ajax.
All I have is the basics of both JavaScript and XML, but not anything Ajaxed.
Anyway, is ajax "long curve" to learn? I would be happy to learn and implement that.

I appreciate your reply, which is great :)

AJAX is JavaScript.
The easiest way to implement it would be using a library, such as jQuery or the scriptaculous ones.

Be aware that 'AJAX' requires JavaScript to be available, so design your sites to work without it.

Will Gresham 81 Master Poster

i read the link you provided and didn't get a solution
maybe i am doing something wrong
and so i started this topic for someone to help me as i am stuck in time
thanks for your fast reply ..appreciated

so could someone plz get what is wrong with the supplied argument in line 42 ?
thanks in advance

The error you are getting tells you exactly what the problem is.
The problem is that the 'supplied argument is not a valid MySQL result resource'.

If you re-read the topic I linked to, you will see it tells you to add error-checking to your queries to tell you what they are not successful.
Add in the error checking and see what errors it gives you.

Will Gresham 81 Master Poster

I just noticed the "Start new thread" buttons and "Reply to Thread" buttons have just got bigger. Why are the buttons on daniweb have suddenly been enlarged? Is there any advantage because I thought the buttons looked better smaller.

I don't see any benefit to it, although there seem to be a few sites that are 'mimicking' Google's recent OAP friendly style or larger buttons and input fields :D.

I'm not too bothered by the bigger buttons though :)

Will Gresham 81 Master Poster

Did you even read the 'Read Me' topic at the top of the forum list?
http://www.daniweb.com/forums/thread191031.html

Will Gresham 81 Master Poster

Again: I'm reiterating because I feel very strongly about this.

The 'new' buttons are distracting and unnecessary. They don't add any features to the site - let me explain. If I have already been in a thread, I know approximately where I left off, and there is already an indicator that there are new posts there (the link is dark blue or something) so I know to go back. If I haven't been in a thread before, then I already know I haven't been in there, the link is still blue, and the 'new' button does nothing except tell me what I already know: that I haven't read any posts in there.

So you see - in either case - I don't see what that button contributes except an eyesore. I'm not trying to be rude because I think this site rocks, and I think almost every feature is pretty good layout-wise. . but this one. . ugh.

+1, valid points :)

I think the previous small blue button was perfectly satisfactory.
I have the old image saved onto my PC and just use GreaseMonkey to replace it :D

It wouldn't be so bad if the image wasn't so 'in your face' I think it is too big and bold.

Will Gresham 81 Master Poster

If you want to use preg functions, then this should work to match strings containing alphanumeric characters and spaces:

$pattern = '#^[a-z0-9\x20]+$#i';
if (preg_match($pattern, $new_pagealias)) $error = "Invalid page alias. Use only normal characters.";
Will Gresham 81 Master Poster

Welcome to DaniWeb :)

Will Gresham 81 Master Poster

Yes :) I prefer to have the times be relative (X minutes ago, X hours ago, X days ago) because everyone on DaniWeb is from a different time zone (and only a small handful of members change their time zones in their profiles, nevermind all the guests). Therefore, this is the only way to ensure that the times are meaningful to everyone.

Ah yes, I get that :)

I was mainly wondering why the full time was called 'Normal' and the x hours ago called 'Detailed'

Will Gresham 81 Master Poster

I noticed the 'new' buttons on the thread lists.

Found them very annoying, I ususally look to see if the thread title is bold to tell if there are any new posts.

Infact, I wrote a GreaseMonkey script just to get rid of them :(
http://stuff.elvenblade.com/remove_new.user.js

Will Gresham 81 Master Poster

Hello from Vista :) I will probably be getting it soon, not quite sure I look the new task bar so much though, looks big and blocky in my opinion, definitely worth a try though.

You can change it :)
http://4sysops.com/archives/windows-7-taskbar-reviewed/

Working in a desktop support environment has its advantages, I get to sit and play around with Win7, but no worries about it messing up my PC..
No doubt lots of people will be calling shortly with very stupid questions :D

Will Gresham 81 Master Poster

Why so many opening and closing tags for PHP?

Get rid of all the unneeded tags, indent your code and missing braces will be more easy to spot.

Will Gresham 81 Master Poster

Instead of this:

if($_POST['form1'].submit)

Try this:

if(isset($_POST['submit_button_id']))

Replace 'submit_button_id' with the ID of the submit button.

Will Gresham 81 Master Poster

Talk to the people who own the server.

Will Gresham 81 Master Poster

You will needs a system such as MySQL installed on the server, in most cases you will not be able to do this. Your host will need to install this for you.

That being said, alot of hosts do include PHP and MySQL as a bundle, contact them to see if this is available.

Will Gresham 81 Master Poster

You can avoid this problem by using a statement similar to CFROGs suggestion. Make sure all fields have a default value, or are allowed to be NULL.

Also, please look at your code, this can probably be reduced by 50% (in terms of the number of lines) due to a lot of repetition. For example, this:

if ($fname){
if (strlen($fname) > 20){
$num ++;
echo "<tr><td>".$num.". Firstname is too long.(3-20)</td></tr><br />";
}
}
if ($fname){
if (strlen($fname) < 3){
$num ++;
echo "<tr><td>".$num.". Firstname is too short.(4-20)</td></tr><br />";
}
}

Could become this:

if ($fname){
  if (strlen($fname) > 20 || strlen($fname) < 3){
    $num ++;
    echo "<tr><td>".$num.". Firstname must be between 3 and 20 characters.</td></tr><br />";
  }
}

That will do practically the same thing, but is only 6 lines rather than 12.

You probably won't see a difference in response in a script like this or on a low traffic site, but in busy sites or much longer scripts then cutting back on unneeded characters and whitespace can help performance :)

Will Gresham 81 Master Poster
Will Gresham 81 Master Poster

I am with AD.

I very rarely use the buttons, typing the tags is just as fast, if not faster (for me), than clicking a button :)

Also, getting people using Code tags consistently is more important than another (possibly confusing) button.

I will agree that the button could do with changing though, the green block doesn't mean anything (in fact, I didn't even know it was there till I saw this thread :$

Will Gresham 81 Master Poster

Search online for registration scripts, there are lots of them.

We will not write your code for you, go research it and ask specific questions when something doesn't work.

Use code tags, its easy. Highlight the code and click the Code button...

Also, why the hell do you have a >2MB jpg image on the page? Waste of bandwidth there.

Will Gresham 81 Master Poster

Yea, in general I would agree to that. Try not to use Pixels or Pt values unless you have a very good reason to do so. It restricts the screen space your users can use.

Although, I always like specifying the width of the outer most element in pixels. I have a bad habit of making everything 800px wide :-]

I used to do that, but my monitor now runs at 1280x1024 so a page with 800px width is too small :) I tend to design for 800x600, i.e. make sure that it doesn't stretch the page at that resolution, but I make it expandable so it works acceptably on most larger resolutions too :D

EDIT:
My post saying /never/ use px values is probably a bit extreme, it is acceptable to use px values for images and the like, but for display blocks such as div, span, and tables, use % as far as is possible :)

Will Gresham 81 Master Poster

Not sure if this has been mentioned before.

One thing that irritated me for a while was seeing '1 hour ago' '2 hours ago' and such on posts. I like seeing the actual Date/Times, but maybe that's just me :)

I have had a look in the CP today and found the settings to change this, my query is on the naming of the options..
It appears that the 'Normal' setting will show a standard date/time of the post; such as 'Oct 27th, 2009, 06:00', 'Yesterday/Today' will do what it says, and 'Detailed' will show the '1 hour ago' '2 hours ago' and such.

Personally, I would expect the results of the Normal and Detailed to be reversed, to me, detailed means more information, which would be the actual timestamp, not just 1 hour ago :)

Just my thoughts :icon_smile:

Will Gresham 81 Master Poster

I am waiting for my Windows 7 disk to arrive :)

Got a free upgrade with a PC I bought this year so I will wait and see what it is like... I suppose it cant be much worse than Vista :D

Will Gresham 81 Master Poster

Use % values for all element width/heights. Use EM for text.

Never specify Pixel ot Pt values.

Will Gresham 81 Master Poster

Remove the spaces between the %s and the value.

If the user entered 'Google' then the search query would look like:

$query = "SELECT * FROM products WHERE artist LIKE '% Google %'";

This would return values where the products column had an entry of 'something Google something'

Will Gresham 81 Master Poster

Many thanks :)

Will Gresham 81 Master Poster

Rugby is quite popular in the UK, I'd say probably less popular than Football (Soccer as america calls it) but its still quite big.

I have seen your American Football, and I prefer Rugby :)

Will Gresham 81 Master Poster

You cannot use AJAX if JavaScript is disabled.

Always try to write your code for non-JavaScript clients and then add AJAX afterwords.

AJAX should be used to enhance the page, it should not be the core of it.

Will Gresham 81 Master Poster

Remove the linebreak after the comment on line 17.

Also, try to put all comments on the line above the code they describe to make reading easier and to prevent syntax errors like this one.

Will Gresham 81 Master Poster

Hello wonderful people :)

Can my username be changed?

I signed up last May and used the same username I use on most sites, but I have since dropped this alias on most sites :D

Can it be changed to Will Gresham please :P

Will Gresham 81 Master Poster

+1, but as far as I am aware, it is not available in the UK yet for anyone :(

Will Gresham 81 Master Poster

ok, lets say u name search field 'search' and the drop-down menu for 'cat'. and make the form POST all info to search.php (method POST action search.php).
In the search.php, the first thing u need to do is to retrieve the posted info.
for example,

$postCode = $_POST['search'];
$cat = $_POST['cat'];

Having done that, u need to query the database. you may want to SELECT all from your postcodestable WHERE postCode = $postCode AND category = $cat and display all info.
If you don't know how to do this, I suggest you to take this tutorial at http://www.tizag.com/mysqlTutorial/mysqlquery.php. Have a skim thru all the links. :)

First, I would not suggest querying the database with POST values, at least run them through mysql_real_escape_string first.

Also, with Postcodes people will not always enter them in the saem format, for example, postcodes may be entered in multiple ways:
AB123CD
AB 123 CD
AB123 CD
AB12 3CD

So I would suggest removing spaces from the POST data before querying and also having the values in the database with no spaces, or use a replace command in the query to remove them for the search. Otherwise there is a chance that you may not get results when you should.

Will Gresham 81 Master Poster

The only PHP code I can find in your post is this on line 777: <? echo $rows['no_matrik']; ?> Please post what the problem is, as well as the relevant code.

Will Gresham 81 Master Poster

This line: $dir = $documentroot . '/' . $del_id; is before you set the value of $del_id.

Try this:

if($countCheck != "0") {
  for($i=0;$i<$countCheck;$i++) {
    $dir = $documentroot . '/' . $checkbox[$i];
    rmdir_r($dir);
  }
}

Also, try to keep code structure constant.. You have opening and closing braces all over the place and no apparent consistent indents, code is much more readable if you keep things consistent. :)

Will Gresham 81 Master Poster

This would probably be better asked in the Javascript forum: http://www.daniweb.com/forums/forum117.html

Will Gresham 81 Master Poster

Still think:
There is no place like ~
Beats the 127.0.0.1

Will Gresham 81 Master Poster

Simply remove all < and > characters, htmlspecialchars should do this though:

str_replace(array("<", ">"), array("&lt;", "&gt;"), $string)