Web Development Questions That Don't Need Their Own Thread v2
3,079 replies, posted
[QUOTE=Adzter;32654937]Hmm.. I've managed to get ahold of a trial of a VPS in europe and everything works except wordpress, perhaps it's just too much work for my slow internet connection?
Ahh.. it's my wordpress setup:
[img]http://puu.sh/6By7.png[/img]
It's trying to connect to my internal IP
EDIT: Should have fixed it, can people connect now?[/QUOTE]
Nope/
Hmm.. seems you've got to go to -snipped-
THEN click the wordpress link... now that is wierd.. but as I'm just using it for showing people and not as an actual site then I'll be able to live with that.
EDIT: Shut it down now, thanks for the help guys :)
[QUOTE=Adzter;32655040]Hmm.. seems you've got to go to [url]http://www.adamwilson.no-ip.org/[/url]
THEN click the wordpress link... now that is wierd.. but as I'm just using it for showing people and not as an actual site then I'll be able to live with that.[/QUOTE]
[img]http://dl.dropbox.com/u/5483751/Photos/2011-10-06_2011.png[/img]
How long has the site been up for? Maybe my ISP hasn't updated the dns yet.
[QUOTE=Adzter;32655040]Hmm.. seems you've got to go to [url]http://www.adamwilson.no-ip.org/[/url]
THEN click the wordpress link... now that is wierd.. but as I'm just using it for showing people and not as an actual site then I'll be able to live with that.[/QUOTE]
It works without the www
[quote]
[IMG]http://gyazo.com/655d9709f1f28cb4697f59f2fb450de6.png[/IMG]
[/quote]
[QUOTE=Adzter;32655040]Hmm.. seems you've got to go to [url]http://www.adamwilson.no-ip.org/[/url]
THEN click the wordpress link... now that is wierd.. but as I'm just using it for showing people and not as an actual site then I'll be able to live with that.
EDIT: Shut it down now, thanks for the help guys :)[/QUOTE]
[quote]
[img]http://puu.sh/6BAm[/img]
[/quote]
[QUOTE=Known Havok;32655096]It works without the www[/QUOTE]
[img]http://dl.dropbox.com/u/5483751/Photos/2011-10-06_2013.png[/img]
:v:
argh, i've been trying to re-teach myself mySQL and for some reason this particular code just gives out a "mysql_fetch_array(): supplied argument is not a valid MySQL result resource"
[code]<?php
//MYSQL
if($_SESSION['logged']!=1&&$_GET['act']!="login") $result="login";
if($_SESSION['logged']==1) $result=$_SESSION['user'];
if($_GET['act']=="login"){
$username=$_REQUEST['username'];
$password=$_REQUEST['password'];
$con=mysql_connect("//","//","//");
if(!$con) die('Unable to start mySQL');
$query="SELECT username, rank FROM usertable1 WHERE username=".$username." AND password=".$password;
$query2=mysql_query($query);
$user=mysql_fetch_array($query2);
if(!$user) $result="login_r";
if($user){
$_SESSION['username']=$user['username'];
if($rank=="0") $_SESSION['rank']=0;
$result="login";
}
mysql_close($con);
}
if($_GET['act']=="register"){
$username=$_POST['username'];
$password=$_POST['password'];
$con=mysql_connect("//","//","//");
if(!$con) die('Unable to start mySQL');
$query="SELECT username, rank FROM usertable1 WHERE username='".$username."' AND password='".$password;
$user=mysql_fetch_array(mysql_query($query));
if(!$user) {
//ADD TO TABLE
}
if($user){
$result="user_ex";
}
}
echo $result;
if($_SESSION['logged']!=1&&$_GET['act']!="login"&&$_GET['act']!="register"&&!$_GET['g']) echo "<form action='index.php?act=login' method='POST'><input type='text' value='Username' name='username' /><br /><input type='pasword' value='password' name='password' /><br /><inpput type='submit' value='Log in' /></form>";
$_CONFIG = array(
"title"=>"Yay For Me",
);
?>[/code]
Don't go into the whole use PDO thing please.
PHP.net is your friend.
mysql_fetch_array Return values:
[quote]
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, [B]or FALSE on error.[/B]
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() [B]returns TRUE on success or FALSE on error.[/B]
The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data.
Use mysql_num_rows() to find out how many rows were returned for a SELECT statement or mysql_affected_rows() to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.
[B]mysql_query() will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.[/B][/quote]
So the problem is with your query. Here's a tip: If you're going to learn MySQL, learn MySQL - there's things like the MySQL console or even a MySQL GUI like HeidiSQL - don't faff about with PHP.
Also, use PDO.
Using mySQL within a PHP context, specifically :P
So what's wrong with the statement? :/
[QUOTE=mobrockers2;32639464]This might be a stupid question but, anyone knows why LAST() and FIRST() aren't working in my mysql? I googled but came up with nothing even remotely relevant to LAST and FIRST.[/QUOTE]
i would like to know how to achieve the following effect with:
[img]http://1337.jp/_/2011/10/SS-2011-10-06_21.08.41.png[/img]
to
[img]http://1337.jp/_/2011/10/SS-2011-10-06_21.08.55.png[/img]
where the hovered selection has a background set to inline display, I want it to be taller so that it falls behind the content div instead of ending where the text is..
[php]
#nav{
position:absolute;
top:60px;
padding:4px;
background:#fff;
border-radius:8px;
-webkit-box-shadow: 0px 0px 30px -3px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 30px -3px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 30px -3px rgba(0, 0, 0, 0.3);
height:50px;
vertical-align:middle;
z-index:-1;
}
#nav a{
display:inline;
background:#fff;
padding:6px;
margin:8px;
border-radius:8px;
text-size:16px;
text-decoration:none;
color:#111;
vertical-align:middle;
}
#nav a:hover{
background:#a0e8a0;
color:#fff;
}
[/php]
does anyone see what I mean?
i have no idea how to approach it, as min-height does not work with text backgrounds apparently
[QUOTE=Kwaq;32656668]i would like to know how to achieve the following effect with:
[img]http://1337.jp/_/2011/10/SS-2011-10-06_21.08.41.png[/img]
to
[img]http://1337.jp/_/2011/10/SS-2011-10-06_21.08.55.png[/img]
where the hovered selection has a background set to inline display, I want it to be taller so that it falls behind the content div instead of ending where the text is..
[php]
#nav{
position:absolute;
top:60px;
padding:4px;
background:#fff;
border-radius:8px;
-webkit-box-shadow: 0px 0px 30px -3px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 30px -3px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 30px -3px rgba(0, 0, 0, 0.3);
height:50px;
vertical-align:middle;
z-index:-1;
}
#nav a{
display:inline;
background:#fff;
padding:6px;
margin:8px;
border-radius:8px;
text-size:16px;
text-decoration:none;
color:#111;
vertical-align:middle;
}
#nav a:hover{
background:#a0e8a0;
color:#fff;
}
[/php]
does anyone see what I mean?
i have no idea how to approach it, as min-height does not work with text backgrounds apparently[/QUOTE]
Eh, padding?
[QUOTE=mobrockers2;32656733]Eh, padding?[/QUOTE]
wow
i guess sometimes i do forget easy things
[QUOTE=Kwaq;32656775]wow[/QUOTE]
Is that a wow why didn't I think of that or a wow that guy has no idea what he's talking about. Because I don't really get what you want it to do :v:
[QUOTE=mobrockers2;32656823]Is that a wow why didn't I think of that or a wow that guy has no idea what he's talking about. Because I don't really get what you want it to do :v:[/QUOTE]
i really wasnt thinking when i asked, for some reason i didnt relate text with padding in my mind and just assumed that it was for divs and stuff i guess v:v:v
What's the best way to tell the difference between two strings with PHP?
for example, I want to find the differences between the two strings
[quote]The brown fox jumps over the lazy dog[/quote]
and
[quote]The quick brown fox jumped over the lazy dog[/quote]
so that it shows i inserted "quick" and "jumps" changed to "jumped" (or "jumps" was removed and "jumped" was added). How would I go about doing this?
I would [url=http://php.net/manual/en/function.explode.php]explode()[/url] it at the spaces and then use [url=http://php.net/manual/en/function.array-diff.php]array_diff()[/url] to get what words are different.
[QUOTE=Jelly;32662518]I would [url=http://php.net/manual/en/function.explode.php]explode()[/url] it at the spaces and then use [url=http://php.net/manual/en/function.array-diff.php]array_diff()[/url] to get what words are different.[/QUOTE]
[php]
$string = "This is a test string \n with newlines";
$newline = explode( "\n" , $string );
$diff = array();
foreach( $newline as $num => $val )
{
$spaces = explode( ' ' , $val );
$diff[ $num ] = array_diff( $spaces );
}
[/php]
?
Is something like that really the best way to do it?
[editline]6th October 2011[/editline]
[QUOTE=TehWhale;32662524][url]https://github.com/paulgb/simplediff/blob/5bfe1d2a8f967c7901ace50f04ac2d9308ed3169/simplediff.php[/url][/QUOTE]
that's what I'm currently using, I was just wondering if there was a better way
[QUOTE=Ac!dL3ak;32662537][php]
$string = "This is a test string \n with newlines";
$newline = explode( "\n" , $string );
$diff = array();
foreach( $newline as $num => $val )
{
$spaces = explode( ' ' , $val );
$diff[ $num ] = array_diff( $spaces );
}
[/php]
?
Is something like that really the best way to do it?
[editline]6th October 2011[/editline]
that's what I'm currently using, I was just wondering if there was a better way[/QUOTE]yes
array_diff is going to be faster than any comparison function you can make in PHP.
Probably not what you're looking for, as it doesn't actually output the diff, but I'll just leave this here:
[url]http://php.net/manual/en/function.levenshtein.php[/url]
[QUOTE=StinkyJoe;32665570]Probably not what you're looking for, as it doesn't actually output the diff, but I'll just leave this here:
[url]http://php.net/manual/en/function.levenshtein.php[/url][/QUOTE]
i knew about levenshtein :v
So I asked my databases teacher why FIRST() and LAST() weren't working. She didn't know either :V
[QUOTE=mobrockers2;32666842]So I asked my databases teacher why FIRST() and LAST() weren't working. She didn't know either :V[/QUOTE]
Probably because there are better ways of doing things.
[QUOTE=Known Havok;32668931]Probably because there are better ways of doing things.[/QUOTE]
No it's because Mysql doesn't support these functions. Could you please tell me this better way then? Because I've asked three times already.
[QUOTE=mobrockers2;32669351]No it's because Mysql doesn't support these functions. Could you please tell me this better way then? Because I've asked three times already.[/QUOTE]They already did, just use DESC and ASC and select the first row
[QUOTE=Octave;32670363]They already did, just use DESC and ASC and select the first row[/QUOTE]
I already did, but how is that a better way than using first() and last() (if they existed in mysql)?
[QUOTE=mobrockers2;32673182]I already did, but how is that a better way than using first() and last() (if they existed in mysql)?[/QUOTE]
I'm not seeing the problem - neither FIRST() nor LAST() are part of the MySQL library (they're in MSSQL IIRC) - alternatives were already suggested.
[QUOTE=StinkyJoe;32673317]I'm not seeing the problem - neither FIRST() nor LAST() are part of the MySQL library (they're in MSSQL IIRC) - alternatives were already suggested.[/QUOTE]
There is no problem.
There is now:
Input:
[code]
SELECT keuze.keuzenm, COUNT(stem.keuze) FROM keuze, stem WHERE keuze.keuze=stem.keuze GROUP BY stem.keuze
[/code]
Output:
[img]http://dl.dropbox.com/u/5483751/Photos/2011-10-08_0502.png[/img]
Now, I want the COUNT(stem.keuze) to order descending, would anyone happen to know how to do this?
[code]SELECT keuze.keuzenm, COUNT(stem.keuze) AS count FROM keuze, stem WHERE keuze.keuze=stem.keuze GROUP BY stem.keuze ORDER BY count DESC[/code]
I haven't done SQL for years though so :v:
Sorry, you need to Log In to post a reply to this thread.