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 8921923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:41:14+00:00 2026-06-15T06:41:14+00:00

I have a table image_tb, which has 3 fields, id,images,link (id is auto auto_increment),

  • 0

I have a table image_tb, which has 3 fields, id,images,link (id is auto auto_increment), this is my insert code:

mysql_query("
insert into image_tb 
(images,link) 
select 
'".(max(id)+1).".jpeg','".$link."' 
from image_tb
");

it return:

Warning: max(): When only one parameter is given, it must be an array

how to modify? thanks.

  • 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-06-15T06:41:15+00:00Added an answer on June 15, 2026 at 6:41 am

    do it inside the query,

    mysql_query("
    insert into image_tb (images,link) 
    select CONCAT(COALESCE((SELECT MAX(ID) + 1 FROM image_tb),1), '.jpeg'),'".$link."' 
    from image_tb
    ");
    

    your query is vulnerable with SQL Injection, please read the article below to protect from it

    • How can I prevent SQL injection in PHP?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in SQL Server. This table has an image field and
I have a table which has two text boxes and an image beside it
i have image table, which has 2 or more rows with same date.. now
So basically I have been trying to insert columns into my third table from
I have a table which has a background image(sprite). The td of the table
I have some code (inherited) which selects a row from table 'members' and also
I have a table in which a column stores image src which is in
I have a table in which each of its TD contains image (more precisely,
I have a table with images and tags in it (called tbl_images ) image_file
I have table view which is showing list of files to download. When I

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.