Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7625053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:08:27+00:00 2026-05-31T05:08:27+00:00

This is my snippet of PHP I am currently using to put a randomly

  • 0

This is my snippet of PHP I am currently using to put a randomly generator string in a row, but it is not working. I need $actc to go into the actc field of the row, but it is not actually doing that, it stays 0.

$chars = "abcdefghijkmnopqrstuvwxyz023456789"; 
srand((double)microtime()*1000000);
$i = 0;
$actc = '' ;
while ($i <= 11) {
$num = rand() % 33;
$tmpc = substr($chars, $num, 1);
$actc = $actc . $tmpc;
$i++;
}
        mysql_query("INSERT INTO users (username, pass, email, ip, actc)
            VALUES ('".$nl."', '".$pw."', '".$email."', '".$_SERVER['REMOTE_ADDR']."', '".$actc."')") or die(mysql_error());

My table structure exported in SQL:

   CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(255) NOT NULL,
  `pass` varchar(60) NOT NULL,
  `email` varchar(255) NOT NULL,
  `ip` varchar(20) NOT NULL,
  `actc` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4531 ;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:08:28+00:00Added an answer on May 31, 2026 at 5:08 am

    It looks like you’re initializing $actc as a string, but the column type in mysql is an int. You can’t insert a non-Int into an Int column.

    Also you are quoting $actc as thought it were a string in your insert statement. Ints are not quoted in mysql insert statements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently my AJAX is working like this: index.php <a href='one.php' class='ajax'>One</a> <div id=workspace>workspace</div> one.php
Is it possible to convert this java code snippet to php? public void testBalanceReturnsToZeroOnVending()
This snippet works well if I try to write in a user directory but
This snippet of code always parses the date into the current timezone, and not
Does anybody knows why this snippet returns false even if the passed string is
Currently I'm using the below snippet, which indent the resulting HTML by using several
I have made a tiny ModX snippet that looks like this <?php $theMenu =
I'm currently using php to populate a form with selections from a database. The
Currently I am creating a website mainly using a mix of PHP, SQL, and
I am using PHP and jquery. I am also using Drupal but I think

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.