| CodeHeads 2006-02-25, 9:43 am |
| --=-yA7s8OCnEhiLKvTprGc/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Thu, 2006-02-23 at 10:49 -0600, Ariel S=C3=A1nchez Mora wrote:
> Probably the problem is in php, or, more probably, in how you store first=
and then look for the IP address in your query. You should try your query =
in the mysql console; varchars work almost with anything and I put this exa=
mple where I look for an IP address with your table, and it finds it correc=
tly.
>=20
> Hope this helps; if you can't find the problem, try little steps with=20
>=20
> select * from portal_forums_users where ip =3D '192.168.1.0';
>=20
> To try and find where you have a problem. You can even try=20
>=20
> select * from portal_forums_users where ip like '%192.168.1.0%';
>=20
> The % are wildcards, and that would take care of periods you inadvertenly=
added/erased. I really think this is not a MySQL problem.
>=20
> mysql> describe portal_forums_users;
> +---------------+--------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +---------------+--------------+------+-----+---------+----------------+
> | user_id | bigint(255) | | PRI | NULL | auto_increment |
> | ip | varchar(200) | YES | | NULL | |
> | signup_date | varchar(30) | YES | | NULL | |
> | city | varchar(200) | YES | MUL | NULL | |
> | state | varchar(100) | YES | | NULL | |
> | email_address | varchar(200) | YES | | NULL | |
> | username | varchar(100) | YES | | NULL | |
> | password | varchar(100) | YES | | NULL | |
> | yim | text | YES | | NULL | |
> | aol | text | YES | | NULL | |
> | web_url | text | YES | | NULL | |
> | post_count | varchar(255) | YES | | NULL | |
> | info | text | YES | | NULL | |
> | sig | text | YES | | NULL | |
> | avatar | text | YES | | NULL | |
> | css_id | int(11) | YES | | NULL | |
> | mod_f | varchar(20) | YES | | NULL | |
> | admin | varchar(20) | YES | | NULL | |
> +---------------+--------------+------+-----+---------+----------------+
> 18 rows in set (0.00 sec)
>=20
> mysql> select * from portal_forums_users;
> +---------+-------------+-------------+------+-------+---------------+---=
-------+----------+------+------+---------+------------
> | user_id | ip | signup_date | city | state | email_address | us=
ername | password | yim | aol | web_url | post_count
> +---------+-------------+-------------+------+-------+---------------+---=
-------+----------+------+------+---------+------------
> | 1 | 192.168.1.0 | x | x | x | x | x =
| x | x
> | x | x | x | x | x | x | 0 | x |=
x |
> | 2 | 10.100.1.1 | y | y | y | y | y =
| y | y | y | y | y
> +---------+-------------+-------------+------+-------+---------------+---=
-------+----------+------+------+---------+------------
> 2 rows in set (0.00 sec)
>=20
> mysql> select * from portal_forums_users where ip =3D '192.168.1.0';
> +---------+-------------+-------------+------+-------+---------------+---=
-------+----------+------+------+---------+------------
> | user_id | ip | signup_date | city | state | email_address | us=
ername | password | yim | aol | web_url | post_count
> +---------+-------------+-------------+------+-------+---------------+---=
-------+----------+------+------+---------+------------
> | 1 | 192.168.1.0 | x | x | x | x | x =
| x | x
> | x | x | x | x | x | x | 0 | x |=
x |
> +---------+-------------+-------------+------+-------+---------------+---=
-------+----------+------+------+---------+------------
> 1 row in set (0.00 sec)
>=20
> -----Mensaje original-----
> De: CodeHeads [mailto:ch@code-heads.com]=20
> Enviado el: mi=C3=A9rcoles, 22 de febrero de 2006 17:35
> Para: Ariel S=C3=A1nchez Mora
> CC: mysql@lists.mysql.com
> Asunto: RE: Number Searches
>=20
>=20
> On Wed, 2006-02-22 at 16:49 -0600, Ariel S=C3=A1nchez Mora wrote:
>=20
> OK, I think I did not explain things right the first time. :(
>=20
> I have a table like so:
> CREATE TABLE `portal_forums_users
` (
> `user_id` bigint(255) NOT NULL auto_increment,
> `ip` varchar(200) default NULL,
> `signup_date` varchar(30) default NULL,
> `city` varchar(200) default NULL,
> `state` varchar(100) default NULL,
> `email_address` varchar(200) default NULL,
> `username` varchar(100) default NULL,
> `password` varchar(100) default NULL,
> `yim` text,
> `aol` text,
> `web_url` text,
> `post_count` varchar(255) default NULL,
> `info` text,
> `sig` text,
> `avatar` text,
> `css_id` int(11) default NULL,
> `mod_f` varchar(20) default NULL,
> `admin` varchar(20) default NULL,
> PRIMARY KEY (`user_id`),
> FULLTEXT KEY `full_index`
> (`city`,`state`,`use
rname`,`email_addres
s`,`ip`)
> ) ENGINE=3DMyISAM DEFAULT CHARSET=3Dlatin1;
>=20
> Notice the FULLTEXT; I have the ip listed to be indexed. Using a PHP scri=
pt I have it will not grab the IP that I am searching for, even though it *=
is* in the database. The ip's are entered into the database as 192.168.1.10=
.. When I search for a username it works great.
>=20
> Is it because of the "." (periods) in the search string??
>=20
> Hopefully I explained that right this time!! :) LOL
>=20
I will have to agree with you on this. I will have to see what I can
come up with.
Thank you all for your help in this! I just wanted to make sure that it
was not a mysql problem. I can fix the php code better then the mysql
database! LOL :)
Thanks again! :)
--=20
Best regards,
~WILL~
Key: http://code-heads.com/keys/ch1.asc=20
Key: http://code-heads.com/keys/ch2.asc=20
Linux Commands: http://code-heads.com/commands=20
Linux Registered User: 406084 (http://counter.li.org/)
--=-yA7s8OCnEhiLKvTprGc/
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)
iD8DBQBD/ fKqfw3TK8jhZrsRAiyxA
KDUnrvcGbfFJxlCs82E8
Ge31b7LXACgtOsx
2x8iHRYS5cI67mVm/X/Jo3U=
=4HLN
-----END PGP SIGNATURE-----
--=-yA7s8OCnEhiLKvTprGc/--
|